wodby/docker4wordpress

Add PHP-FPM file permission for .htaccess and plugin directories.

kallehauge opened this issue · 1 comments

Docker compose file

WordPress stack 5.0.5 and previous.

Feature request

Make more directories writable by the PHP-FPM container - this issue is meant to be used as a reference list and should be expanded down the line when more permissions come along.
The files/directories listed here are not necessarily the only ones that have potential conflicts and some of them will simply not be supported for security reasons (wp-config.php) but they are still listed for documentation and as a way for people who search for these files to find this issue.

WP-Rocket requires write access to the following files in the PHP-FPM container:

  • .htaccess - possibly also Nginx (I have not yet look at this solution but WP Rocket points to this configuration setup for Nginx: https://github.com/maximejobin/rocket-nginx)
  • wp-content/wp-rocket-config/
  • wp-config.php(*)

WooCommerce:

  • wp-content/uploads/wc-logs/: WC complains about missing write permission to this directory if WC Logging should work. Chingis previously wrote the following to me:

wp-content/uploads completely owned by www-data, if you need get write access on files inside uploads, you can use sudo files_chmod to /mnt/files/* (it's the original location of wp-content/uploads symlink.

(*) Just a quick WP Rocket note for possible future reference: It is on purpose that wp-config.php is not writable by the PHP-FPM container due to security reasons but it does mean that it is not possible to disable WP Rocket in the interface because it cannot write to wp-config.php and set WP_CACHE to FALSE.


A current workaround is to add a post-deployment-script that adds www-data as the group to any known directories that might exist so PHP-FPM will have write access.

wp-rocket-config/ has been added to the list of writable dirs inside wp-content/, .htaccess shouldn't be added for the same reason as wp-config.php