Centos – PHP cant write files regardless of permissions

apache-2.4centoscentos7permissionsPHP

On a Centos 7×64 box apache/php is unable to write files regardless of permissions. I set the directory to apache:apache and even set it to 777 and php is still getting permission errors.

What else could possibly be denying PHP from writing files?

Best Answer

You can set SELinux to permissive mode in order to analyze.

    # setenforce 0

SELinux will log but permit to access. So you can check the /var/log/audit/audit.log for details. Maybe you will need to change SELinux context. For this, you will use chcon command. If you need, show us your audit.log for more detailed answer.

Don't forget to enable SELinux after you solve the problem. It's better keep SELinux enforced.

    # setenforce 1