We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Trouble writing to volt dir on CentOS 7 with SELinux in home dirs

Been setting up some servers over the last few days and have run into a strange problem. SELinux is denying access to the volt cache directory for /home/user/www/domain.co.uk/backend/cache/volt. The below is in the audit log from SELinux:

type=AVC msg=audit(1413053033.813:3210): avc: denied { write } for pid=20856 comm="httpd" name="volt" dev="dm-0" ino=54358309 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_user_content_t:s0 tclass=dir

The directory (and subdirs) /home/user/www/domain.co.uk have the context "httpd_user_content_t" but Volt is still failing to compile files.

Anyone else been able to get to the bottom of this issue?

UPDATE: Found something similar in SO about this but I've already done those mentioned steps and yet compileFile() is still getting permission denied. - https://stackoverflow.com/a/25687421

I've also tried moving these out of home dirs with no change.



58.4k
edited Oct '14

you should chown directory to be webserver, for example if you running web service is nginx

    chown nginx:nginx -R /home/user