Selinux – allow fwrite php in centos7

How to allow fwrite php command in centos7? You must set exact directory for writing.  ( e.g. cache dir ):

semanage fcontext -a -t 'httpd_cache_t' '/path/to/www/cache(/.*)?'

restorecon -Rv /path/to/www/cache

Tip: do not disabling Selinux ! Is good reasons for prevent hack your site!

Tip2: http://www.serverlab.ca/tutorials/linux/web-servers-linux/configuring-selinux-policies-for-apache-web-servers/

enjoy!

SHARE IT:

Leave a Reply