• Resolved Grzegorz.Janoszka

    (@grzegorzjanoszka)


    I moved my site to PHP7 and noticed weird behavior of one plugin, its data was displayed completely off. Troubleshooting I found out that the culprit was autoptimize. Its option to move inline CSS to separate files (not sure how it is called in English, I have a localized version) breaks up the code.
    Could you please check the PHP7 compatibility with this plugin?
    Thank you in advance!

    https://www.ads-software.com/plugins/autoptimize/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Frank Goossens

    (@futtta)

    running PHP7 myself on one of my dev-env’s and haven’t seen a problem yet, but then off course I could be mistaking ??

    so;
    * when considering these options, which one are we talking about:

    Optimize CSS Code?
    Generate data: URIs for images?
    Remove Google Fonts?
    Also aggregate inline CSS?
    Inline and Defer CSS?
    Inline all CSS?
    Exclude CSS from Autoptimize

    * how does the error present itself, where should I be looking? php-errorlog? in the resulting HTLM? what specificall?
    * if specifically related to output of one plugin; which one would that be?

    frank

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Sorry, it is “Also aggregate inline CSS”. The translation is horrible and misleading, it would be nice to have a checkbox to force English in the plugin ??
    It works very well on PHP 5.6, but when I migrate all the files and DB to a server with PHP 7.0, this option seems to move some stuff around.

    Plugin Author Frank Goossens

    (@futtta)

    can you explain “this option seems to move some stuff around” a bit more? is this linked to a specific theme or plugin? do you see anything in your php-errorlog?

    frnak

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Well, there have been some other things moved, but after clearing all the caches (including the browser one) they were clean. The problem remains with one plugin – Aspexi Facebook Like Box.

    Please check: “old” site: https://paleosmak.pl/ – the facebook box is on the right. The new site is https:// test .paleosmak.pl/ (I am breaking the URL so the crawlers will not go there) – the facebook box is way down at the bottom left.

    Both have identical options to Autoptimize. The “old” site has PHP 5.6, the new one has PHP 7.0. After disabling the option “Also aggregate inline CSS” the new site has a proper facebook box. I initially thought it was the plugin “Aspexi Facebook Like Box”, but after doing some tests with the author it looked like that plugin was OK and somehow things got messed by that one option of Autoptimize.

    In about 12 hours the test site will become the main one, so I hope you will be able to see it before I migrate ??

    Thank you so much for your great and awesome plugin and fantastic support!

    Plugin Author Frank Goossens

    (@futtta)

    css optimization is not working at all it seems; there’s a autoptimize_xyz.css file, but it isn’t working (getting “Permanently gone”) and there are a lot of css-files still referenced in your HTML. something seems badly broken really. is “optimize CSS” on now?

    Plugin Author Frank Goossens

    (@futtta)

    installed twenty fourteen (which is your base theme, correct) and tested on my PHP7-machine; all works as expected Grzegorz. only difference; I’m on the to-be 2.0.1, so as a last resort maybe try that one on your blog instead of 2.0.0 by downloading the zip-file from GitHub and overwrite your /autoptimize/ folder with the contents of that?

    frank

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    OK, I think I know where the problem might be. I moved the whole site using instructions on WP site. I used the option to add to wp-config following lines:

    define(‘WP_HOME’,’https:// test .paleosmak.pl’);
    define(‘WP_SITEURL’,’https:// test .paleosmak.pl’);
    define(‘RELOCATE’,true);

    (agains spaced added to fool bots). But autoptimize creates links to css files on https://paleosmak.pl – without test.

    So actually the problem is not with PHP7, but with migration. In the DB I have original name of the site, I just temporarily forced it using the variables in wp-config.php.

    I think it is something you could take a look at. The links should go to the current server, not the other one.

    Once I migrate everything and remove the forced hostnames I will write here what the result will be.

    Plugin Author Frank Goossens

    (@futtta)

    hmmm, I think the real problem is that your wp-content-url (which AO uses) still points to the non-test URL, not only for AO but for all resources, cfr. e.g. this image

    <img src="https://paleosmak.pl/wp-content/uploads/2014/04/paleo-smak-header.jpg">

    to fix this you will also need to add something like this to you wp-config;

    define( 'WP_CONTENT_URL', 'https://example/blog/wp-content' );

    frank

    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Frank, I followed: https://codex.www.ads-software.com/Changing_The_Site_URL
    It doesn’t say anything about WP_CONTENT_URL.
    Do you think the above page is not complete? Not sure what can be done to help other people in the future in case of similar issue.

    And one more thing – I moved the site and everything is fine, even with ‘also aggregate inline CSS’, so actually your plugin works perfectly fine with PHP7 ?? The problem was caused by missing CSS as the URL’s referred to the ‘old’ site.

    By the way – what is your view on aggregating inline CSS? Is it worth it if it is not too much?

    Thank you for all your help.

    Plugin Author Frank Goossens

    (@futtta)

    It doesn’t say anything about WP_CONTENT_URL.
    Do you think the above page is not complete?

    given that not only the AO-files, but also images still pointed to your non-test domain, that at least for your context the above page was not complete indeed. but normally wp-content-url is (should be) derived from wp-siteurl if I’m not mistaking so …

    […] so actually your plugin works perfectly fine with PHP7 […] so actually your plugin works perfectly fine with PHP7 ??

    great news, big relief actually ??

    what is your view on aggregating inline CSS? Is it worth it if it is not too much?

    it’s clearly less important then “aggregate inline JS”, as inline JS can be render blocking, while inline CSS (as far as I know) not. so it probably is not terribly important ??

    frank

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘PHP7: Some CSS options broken’ is closed to new replies.