• Resolved chad171

    (@chad171)


    Hi there!

    Seems like using free Hummingbird plugin may conflict with server cron job? We deactivated Hummingbird and the warming went away. PHP warning on our server via cron jobs, as follows:

    PHP Warning: mkdir(): File exists in /home/[system user]/[website URL]/public/wp-content/plugins/hummingbird-performance/core/class-logger.php on line 184

    We removed the details of the system user, and website URL for confidentiality reasons.

    The cron job we use on server level is in place because WP-cron has been disabled via wp-config for this website.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @chad171

    We had some similar issues around this file, could you please try to check that the following directories exist in the wp-content directory and have the default 755 permissions?

    wphb-cache
    wphb-logs

    Thank you,
    Dimitris

    Thread Starter chad171

    (@chad171)

    Both folders are present in the wp-content folder.

    the wphb-log folder is empty.

    wphb-cache has the following permissions:

    (fodler) cache: drwxr-xr-x
    (fodler) gravatar: drwxr-xr-x
    index.html: -rw-r–r–
    wphb-cache.php: -rw-r–r–

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @chad171

    Thanks for response!

    The part of the Hummingbird’s code that reports this error first checks if the “wphb-logs” folder exists and “is writable” within content path (which usually/by default is /wp-content/ folder, unless specifically changed).

    This is a “joined” check in that sense that:

    – if folder doesn’t exit, it fails
    – if folder does exist but is not writable – it fails as well

    But only if it fails there’s a function “mkdir()” used that’s meant to create that folder – and that is the function that returns the error.

    Given the check logic and the error content, it would confirm that the folder does exist but is not writeable.

    I see that you have checked permissions of content inside /wp-content/wphb-logs folder but what are permissions of that folder itself?

    If it’s 755 (or “drwxr-xr-x”) already, try setting it to 775. If that doesn’t help, please

    – go to the “Tools -> Site Healt” page in site’s back-end -> “Info” tab and check the exact value of WP_CONTENT_DIR under “WordPress Constants” tab; see if it is correct in comparison to the actual/real path

    – then check please current setting of “open_basedir” PHP option; you can do it e.g. by putthing the .php file in a root folder of your site (just remove it after it’s checked) with a following code in it

    <?php 
    phpinfo();
    ?>

    and visiting it in browser

    – finally, please check what user/group is webserver running with and what is a user/group that “own” the wphb-cache folder on server (in case you are unsure about it, please ask your host for help).

    Update us here with these information, please.

    Kind regards,
    Adam

    Thread Starter chad171

    (@chad171)

    Directories permission: 755
    Files permission: 644

    We just changed the folder permission from 755 to 775 for:
    wphb-cache
    wphb-logs

    Changing permissions did not seem to help.

    ———-

    These statistics were taken before the change of permissions mentioned above.

    WP_CONTENT_DIR: /home/[system user]/[website URL]/public/wp-content

    The main WordPress directory Writable
    The wp-content directory Writable
    The uploads directory Writable
    The plugins directory Writable
    The themes directory Writable
    The must use plugins directory Writable

    ———-

    In the PHP-FPM file (we are using PHP 7.3 for this website):

    ; open_basedir, if set, limits all file operations to the defined directory
    ; and below. This directive makes most sense if used in a per-directory
    ; or per-virtualhost web server configuration file.
    ; Note: disables the realpath cache
    ; http://php.net/open-basedir
    ;open_basedir =

    ———-

    The owner/group is the correct one. Which is the system user for this website.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @chad171

    Thank you for the information, everything looks good,

    We will need to try to replicate the issue on our end, can you let us know the frequency that you set your custom server cronjob?

    Also, had you disabled the WP cron jobs too? https://wpmudev.com/blog/set-up-cron-job-cpanel-wp-cron/

    Best Regards
    Patrick Freitas

    Thread Starter chad171

    (@chad171)

    The server cronjob is set as every 15 minutes.

    Wp-cron is disabled via wp-config.

    Thread Starter chad171

    (@chad171)

    We do not use cPanel though. This is a control panel (Ploi.io) from our hosting provider.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @chad171,

    Thanks for providing further information; I tried setting up Server Cron in my test server but couldn’t notice any such warning notices when tested.

    Could we know you notice it instantly after Hummingbird is enabled? or only see it after enabling/disabling any specific settings? In general, the mentioned warning only points that the directory already exists.

    I tried to run Asset Optimization, enabled cache and set intervals but couldn’t notice any such warnings.

    Are there any steps to replicate the issue? If yes, could you please share the steps to check further regarding this?

    I’m also bringing the warnings mentioned to our developer’s attention to see if anything specific might have triggered this.

    I will keep you posted once we get further feedback asap.

    Kind Regards,
    Nithin

    Thread Starter chad171

    (@chad171)

    We do not have Asset Optimisation turned on for this client’s websites. Gzip, Page Caching, Browser caching, and Gravatar caching is turned on.

    Yes, the warning comes up only after Hummingbird is activated in plugins.

    If it matters, settings for browser caching is:
    JavaScript, CSS, and Images: 7 days.
    Media: Disabled.

    We have Smush Free installed on all the websites.

    Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @chad171 !

    Hope you’re doing great today!

    I also wasn’t able to replicate this issue, however I’ve reviewed the code mentioned in the error message and it looks like the warning is harmless and can be disregarded (or you can deactivate Warning level messages in your PHP configuration).

    Here’s a bit longer explanation of what’s happening:

    Hummingbird will try to create its working directories – if they already exist, then nothing should happen. However, looks like PHP is emitting a Warning when the directory already exists as per the documentation page:

    Emits an E_WARNING level error if the directory already exists.

    https://www.php.net/manual/en/function.mkdir.php

    I will let the team know about this so they can add a workaround. For now I have a suggestion in case deactivating logging/warnings isn’t an option.

    Please edit the file mentioned in the warning and change the line 184 which says:

    if ( ! mkdir( $this->log_dir ) ) {

    To:

    if ( ! @mkdir( $this->log_dir ) ) {

    This will prevent the warning from being emitted. This workaround will unfortunately be overwritten after an update so it will have to be applied again.

    Warm regards,
    Pawel

    Thread Starter chad171

    (@chad171)

    Thanks for the update!

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

The topic ‘PHP warning when used with server cronjob’ is closed to new replies.