PHP is_writable() function always returns false for a writable directory PHP is_writable() function always returns false for a writable directory linux linux

PHP is_writable() function always returns false for a writable directory


After much head-scratching, it transpired that SELinux was preventing the directory from being written to. I found a good tutorial that explains what's going on. I was able to fix it by running this command:

sudo chcon -R -t httpd_sys_rw_content_t tmp


in CentOS 6 above should be SELinux enable enforcing

setenforce Permissive

check the status

sestatus

refer to https://wiki.centos.org/HowTos/SELinux


to write to a directory you also need execute permissions to the dirs above.

namei -l /var/www/html/limesurvey/tmp

should show which step you do not have the correct permissions for.