YII under Fedora with SELinux

posted in: Linux 0

Running YII (release 1) under Fedora with SELinux required some adjustments to eliminate runtime errors and prevent the throwing of warnings. I have documented them here.

in index.php set the timezone after the definitions

#set timezone
date_default_timezone_set('America/Denver');

require_once($yii);
Yii::createWebApplication($config)->run();

for error CException:

Application runtime path "/var/www/html/yiitest/protected/runtime" 
is not valid. Please make sure it is a directory writable by the Web 
server process.

temp setting

chcon -Rv --type=httpd_sys_content_t /var/www/html

To set the context permanently:

semanage fcontext -a -t httpd_sys_content_t "/path to/html(/.*)?"

For full exlplanation

http://wiki.centos.org/HowTos/SELinux
SELinux HowTo

http://docs.fedoraproject.org/en-US/Fedora/13/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html

Comments are closed.