Apache does not have write permission on html folder Apache does not have write permission on html folder apache apache

Apache does not have write permission on html folder


Permission issue to the a.txt file

Warning: file_put_contents(a.txt): failed to open stream: Permission denied in /var/www/html/index.php on line 2


If you are on Centos SELinux, to allow write to specific directories to apache user use the following commands. Make sure you change /var/www/html/logs to whatever directory you need to write to.

$ chcon -t httpd_sys_rw_content_t /var/www/html/logs/ -R

Source: https://www.svnlabs.com/blogs/centos-7-selinux-apache-php-writeaccess-permission/