Support » Localhost Installs » Warning: chmod(): Operation not permitted in /wp-admin/includes/class-wp-filesys

  • Resolved SRD75


    Hi Folks,

    I’m running a local XAMPP website on macOS Monterey.

    At the top of the website, I see 4 instances of:

    Warning: chmod(): Operation not permitted in /wp-admin/includes/class-wp-filesystem-direct.php on line 173

    If I check the website’s local folder, I see system, admin, and Everyone all have read/write access applied to all files and folders.

    In wp-config.php, I see

    define( 'FS_METHOD', 'direct' );
    define( 'FS_CHMOD_DIR', 0775 );
    define( 'FS_CHMOD_FILE', 0664 );

    Help appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz


    I’m not the best person to answer, but seeing as no one else has yet answered, I’ll give it a go. In order for chmod to work, the target needs to be owned by the user WP and PHP runs as. Having write permission isn’t enough. Usually the owner is correct because WP created its file structure during installation. But things can get messy with local emulations like XAMPP.

    Typically 755 and 644 permissions are adequate, but can make it difficult for you to also manipulate files since you’re not the owner. 775 and 664 make it easier for you, it shouldn’t matter to WP. Without knowing what chmod was being applied to, it’s difficult to offer a solution. The change may not even be that critical to site operation.

    One solution if the target is known is to set its permissions manually. I think in XAMPP it needs to be done via FTP, I don’t think its permissions overlap with Mac’s. Or even better, change the target’s owner to that of the WP user.

    Or you might try making the FS_CHMOD_DIR and FS_CHMOD_FILE definition lines into comments (place // in front of each). I don’t think they’re essential to WP operation, it’s for your convenience. Of course if you encounter problems after doing so, undo the commenting.

    The real issue is why is WP not the target’s owner to start with? We may never know.

    Thread Starter SRD75


    Thanks for your reply, @bcworkz.

    I’ve commented out:

    // define( 'FS_CHMOD_DIR', 0775 );
    // define( 'FS_CHMOD_FILE', 0664 );

    but this does not resolve the issue.

    How would I make WordPress the owner of the website?

    Thread Starter SRD75


    I’ve tried changing the owner of the website folder to root:

    cd /Applications/XAMPP/xamppfiles/htdocs
    % sudo chown -R root mandoeprod.local
    % sudo chown -R root:admin mandoeprod.local

    but this does not resolve the error either.

    Thread Starter SRD75


    I changed from XAMPP to Local, by Flywheel, which resolved the problem.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Warning: chmod(): Operation not permitted in /wp-admin/includes/class-wp-filesys’ is closed to new replies.