• I’m getting the error “We were unable to create the wordfence-waf.php file in the root of the WordPress installation” when I attempt to optimize the Wordfence Web Application Firewall. I’ve done some searching around and this appears to be a permissions issue. The problem is both Nginx and PHP-FPM have permission to write to the root of my site.

    I’ve temporarily opened up permissions to test and it’s still not working.

    Permissions on the root folder (and everything within):

    www-data:www-data
    rwX:rwX

    Also, I’ve tried to run a command as the www-data user to see if files actually can be created and it creates them without issue:
    sudo -H -u www-data bash -c 'touch ~/testing.txt'
    The file testing.txt is created in the root without issue.

    On the diagnostics page, the PHP Environment Process Owner is www-data and there are no warnings in the Filesystem tab.

    At this point I have no idea what to do.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @plixer,

    Can you check the permissions for the htdocs (or document root folder)?

    It might be named /var/html/ or /var/www/html/.

    It really looks like you know your stuff :), but you’re checking the root of the file-system and your home directory instead of the document root directory.

    Dave

    Thread Starter Refringe

    (@plixer)

    Sorry Dave, I changed those paths in my comment to trim down length, but I can see now that it just makes things less clear.

    By root I meant site’s public folder:
    sudo getfacl /srv/www/blog.website.ca/public

    # file: public
    # owner: www-data
    # group: www-data
    # flags: -s-
    user::rwx
    group::rwx
    group:webteam:rwx
    mask::rwx
    other::---
    default:user::rwx
    default:group::rwx
    default:group:webteam:rwx
    default:mask::rwx
    default:other::---
    

    As you can see the public folder where the root of the site is located is writeable by the www-data user and group.

    Additionally, this was the full command that was run to test write permissions:
    sudo -H -u www-data bash -c 'touch /srv/www/blog.website.ca/public/testing.txt'

    Thanks!

    • This reply was modified 5 years, 11 months ago by Refringe. Reason: Formatting
    • This reply was modified 5 years, 11 months ago by Refringe.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unable to Create wordfence-waf.php’ is closed to new replies.