• I am hoping I can use your great plugin to speed up our website. But I am having some issues with it. When I activate it, it really messes it up and gives this error:

    PHP Warning: file_put_contents(/nas/wp/www/cluster-2349/learnbonds/wp-content/cache/autoptimize/autoptimize_b1b3a88cd5d8cfd4d1b5a716beef375a.php) [function.file-put-contents]: failed to open stream: Permission denied in /nas/wp/www/common/production/php_prevent_flock.php on line 21

    The site is learnbonds.com

    Any help would be greatly appreciated, thank you!

    Tom

    https://wordpress.org/plugins/autoptimize/

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

    (@futtta)

    Well, based on the error, Autoptimize cannot write the optimized files to the cache-folder due to configuration on the server (apparently set in php_prevent_flock.php).

    Can you check with you hoster to see what is happening there?

    Thread Starter NLWD

    (@nlwd)

    I check with the hosting (WPengine) here is what they said:

    “As far as I can tell, the error we’ll dealing with now isn’t an actual permission denied error, but a glitch in the plugin that’s producing a misleading error.”

    Any idea what we can do to get this working?

    Thanks! Tom

    Plugin Author Frank Goossens

    (@futtta)

    No idea, really. The file is written using a very standard PHP-function (file_put_contents) like this (from autoptimizeCache.php on line 52);

    file_put_contents($this->cachedir.$this->filename,$phpcode);

    Based on the warning you see, the error (which clearly states permission is denied) seems to stem from “something” in /nas/wp/www/common/production/php_prevent_flock.php on line 21, which is not part of autoptimize.

    What is even weirder; I have other users on WP Engine (example here) who are able to use Autoptimize just fine.

    Conclusion; I really have no idea why it doens’t work, but I’m pretty convinced this is not a Autoptimize problem.

    Thread Starter NLWD

    (@nlwd)

    Here is the latest response from WPEngine:

    “Apologies for the problems here.

    The error message in the log :

    [Tue Jul 15 11:13:53 2014] [error] [client 54.88.111.48] PHP Warning: file_put_contents(/nas/wp/www/cluster-2349/learnbonds/wp-content/cache/autoptimize/autoptimize_b1b3a88cd5d8cfd4d1b5a716beef375a.php) [function.file-put-contents]: failed to open stream: Permission denied in /nas/wp/www/common/production/php_prevent_flock.php on line 21
    Actually points to the problem.

    The WP Engine platform prevents the PHP flock() or the file locking function. This causes an issue with our network attached storage servers and is thus blocked.

    Unfortunately, due to the stability issues this causes, we are not able to make exceptions to this currently.

    If you are able to reach out to the plugin’s developer for an alternative or a way to disable the plugin’s built-in caching functionality, that would be most beneficial.

    Alternatively, it seems like you might need to find an alternative plugin that suits your needs without the flock() function.”

    Plugin Author Frank Goossens

    (@futtta)

    Well, there is no flock in Autoptimize at all and I’m not setting the lock_ex flag in file_put_contents() either, so I still can’t imagine what I could do to fix this.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘autoptimize breaks my site’ is closed to new replies.