Hummingbird File System Issue

Hummingbird cache reports wp-content not writable when it is. I guess I'm going to have to downgrade to the previous version as now its continually (about 150 times a second) throwing

PHP Warning: error_log(/webstuff/blogs/wp-content/wphb-cache/page-caching.log): failed to open stream: No such file or directory in /webstuff/blogs/wp-content/plugins/wp-hummingbird/helpers/wp-hummingbird-helpers-core.php on line 227

Even when the wphb file cache isn't activated.

  • James Morris
    • WordPress Enthusiast

    Hello Steve Atty,

    I hope you are well today.

    This issue has been flagged for our SLS Team (code experts) so that they can dig into this issue further for you. An update will be posted here as soon as more information is available. Thank you for your patience while we sort through this issue.

    Best regards,

    James Morris

  • Steve Atty
    • Site Builder, Child of Zeus

    No - directory is not created.

    wp-content permissions:

    drwxrwxr-x 9 steve www-data 4096 Nov 3 19:04 wp-content

    Manually created directory:

    drwxrwxr-x 2 steve www-data 4096 Nov 6 19:26 wphb-cache

    Trying to enable caching plugin reports:

    Error: The wp-content directory is not writable. Ensure the folder has proper read/write permissions for caching to function sucesfully.

    The problem is that the code that reports this error is :

    if ( 'direct' === $access_type ) {
    				// You can safely run request_filesystem_credentials() without any issues
    				// and don't need to worry about passing in a URL.
    				$credentials = request_filesystem_credentials( site_url() . '/wp-admin/', '', false, false, null );
    				// Initialize the Filesystem API.
    				if ( ! WP_Filesystem( $credentials ) ) {
    					// Some problems, exit.
    					return new WP_Error( 'fs-error', __( 'Error: Unexpected error while writing a file. Please view error log for more information.', 'wphb' ) );
    			} else {
    				// Don't have direct write access.
    				return new WP_Error( 'fs-error', __( 'Error: The wp-content directory is not writable. Ensure the folder has proper read/write permissions for caching to function sucesfully.', 'wphb' ) );

    So if get_filesystem_method returns anything but 'direct' then your code errors out.

    Other plugins (wp supercache etc) have no problems creating files and directories under wp-content - what they can't do is delete system files or directories. as they are owned by the user steve. WP Updates are carried out using SSH and Keys

    Oddly enough if you manually create the directory some files get written into it:

    steve@Debussy:/webstuff/blogs/wp-content/wphb-cache$ ls -ltr
    total 24
    -rw-r--r-- 1 www-data www-data     0 Nov  6 19:27 index.html
    -rw-r--r-- 1 www-data www-data 23997 Nov  6 19:41 page-caching.log

    If I change that direct check to
    if ( 'ssh2' === $access_type ) {

    then the cache starts working.

  • Steve Atty
    • Site Builder, Child of Zeus

    OK I found I had an SSH config issue which I've now fixed.

    If I change the if to
    if ( 'direct' === 'direct' ) {

    Then it all works.
    However you have to keep the wp-config.php writeable by the server process user or the plugin complains that it cant add

    define('WP_CACHE', true);

    even when its there.

    This is because the code has this:

    // wp-config.php is not writable.
    	if ( ! is_writeable( $config_file ) || ! is_writable( dirname( $config_file ) ) ) {
    		$this->error = new WP_Error(
    			__( "Hummingbird could not write to the wp-config.php file. Please add the following line to the file manually: <br><code>define('WP_CACHE', true);</code>", 'wphb' )
    		return false;
    	// WP_CACHE is set to false.
    	if ( defined( 'WP_CACHE' ) && false === WP_CACHE ) {
    		$this->error = new WP_Error(
    			__( 'It seems that <strong>WP_CACHE</strong> is set to <strong>false</strong> in the wp-config.php file. Please change it to <strong>true</strong> in order for the page caching functions to work properly.', 'wphb' )

    So rather than check if the variable is set and do something if it isn't you just error out if the file is not writeable... even when you don't need to write to it.

    I really do not want to have my wp-config.php writable by the server process.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.