mkrause
Forum Replies Created
-
Hi Kowsar, thanks a lot! I tested the new versions on the first website and it seems to work fine. I will update all my sites in the next few days. I will let you know if I run into any problems.
Hi Kowsar, changing the line as you recommended has the same effect as defining the constant in the config – i.e. WordPress stopped crashing with fatal error, but caching still cannot be enabled because WP-Optimize says it cannot write to
wp-content/advanced-cache.php
. This doesn’t change when I makewp-content
writable – WP-Optimize still usesssh2
to access the file and fails for unknown reasons (and sorry to repeat this, but WordPress is still able to install or update plugins via thessh2
FS method inwp-content
without any problems). Here are the folder and file permissions:drwxrwxr-x 11 wp www-data 15 13.?feb 16.26 wp-content/
-rw-rw-r-- 1 www-data wp 2721 13.?feb 16.27 wp-content/advanced-cache.phpnginx process runs under
www-data
andssh2
FS is configured to use the userwp
. Under both users, I can create files underwww-data
and edit existing files includingadvanced-cache.php
.- Here’s the info about the site (I anonymized paths and domains, but didn’t change any other data) in it: https://pastebin.com/1qbh6rfj
- I changed the line as you mentioned, but it doesn’t change anything. Without explicitly defining the
FS_CHMOD_FILE
constant inwp-config.php
, the site crashes with the same error as before (Undefined constant…
). If I define it in the config, the site does not crash anymore, but it is not possible to enable caching because plugins throw this error:The request to write the file /home/wp/www/mydomain.xyz/wp-content/advanced-cache.php failed
. These errors appear in the log after attempting to enable caching
PHP Warning: file_put_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/advanced-cache.php): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 285
PHP Warning: file_get_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/advanced-cache.php): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 258
PHP Warning: file_get_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-config.php): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 258
Could not turn off the WP_CACHE constant in wp-config.php
PHP Warning: file_get_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/advanced-cache.php): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 258
PHP Warning: file_get_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/advanced-cache.php): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 258
PHP Warning: file_put_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/wpo-cache/config/config-www.mydomain.xyz.php): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 285
PHP Warning: file_get_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/uploads/wpo/logs/cache-1956f685704ef8774d64.log): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 258
PHP Warning: file_put_contents(ssh2.sftp:///home/wp/www/mydomain.xyz/wp-content/uploads/wpo/logs/cache-1956f685704ef8774d64.log): Failed to open stream: operation failed in /home/wp/www/mydomain.xyz/wp-admin/includes/class-wp-filesystem-ssh2.php on line 285
- Full Cache Purge triggered by: WPO_Page_Cache::disableHi, thank you for your reply. I can check everything you recommend, but I’m not sure what exactly to check at the moment? As far as I can tell, WordPress is configured according to the official documentation, ssh2 access works fine for updating plugins, themes etc, and other plugins (including WP-Optimize before 4.0) are able to write directly to their specific folders if I manually set the required permissions for them. At the moment, I would prefer not to make the whole WordPress installation writable by the web server process directly (as these sites are mostly managed from the command line with wp cli), but I also want to prevent WP-Optimize from using ssh2 access, as this would be a performance disaster – the opposite of its purpose.
When the user deletes the post, the standard WordPress method
wp_delete_post
function is used, so there should be no difference for WP-Optimize. It is also strange that the cached_author_id is NULL because only the post was deleted, but the author still exists.Hi Ben, the URL in cached_url doesn’t exist anymore (these are user-published ads and are deleted by the owner when the item is sold). Calling the URL again doesn’t trigger a new error (normal 404 page is displayed).
I tried to identify the moment when it appears, but without success. It occurred to me that it might be related to the use of the page caching plugin (WP-Optimize). Maybe some kind of race condition between deleting the post and removing the page from the cache? Not sure, just an idea.
Hi Ben, thanks for your reply – the filter works like a charm, problem solved ??
Hello @missveronicatv, sorry for the late reply. The problem occurs only once a day, so experimenting takes some time. I tried your snippet, but it doesn’t work. Returning false doesn’t break the filter calling chain, so it still continues to WP-CLI’s own redirect handler, which doesn’t check if the location is false and still prints the exception.