Installing Yii on Fedora 13 (SElinux)

hi guy I need help, I have installed Yii on my fedora 13 by running all the necessary commands on the terminal. When I try to access my newly created project I get this error

CException

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

I have changed runtime folder to 777

That should work… you have to do the same for assets folder…

I have this same issue right now. I think it might be something in Fedora’s default httpd.conf. I’ll look into it tonight add see what I find. BTW I got 777 on everything in my /var/www folder since it’s a test server only. If anyone has already fixed this would be great to know before I spend allot of time tying.

Thanks,

John

Ok after playing with a few settings I found out quickly It’s not apache its SElinux. I disabled SElinux and low and behold everything works now. If your Linux distro has SElinux you can disable it and everything should work. For people worried about safety. I don’t know how to configure it to allow php or apache, but if your server is not “public” there should be no harm disabling it. However, if someone knows how to let php and apache though SElinux please tell.

The command to Temporarily turn it off is.

echo 0 >/selinux/enforce

(http://www.crypt.gen.nz/selinux/disable_selinux.html)

check the security context on the files and directories, e.g.

ls -Z /var/www/html/

notice there are new columns, something like

-rw-r–r-- wei wei user_u:object_r:httpd_sys_content_t index.php

files served by apache need to be user_u:object_r:httpd_sys_content_t

directories and files that can be written by apache need to be user_u:object_r:httpd_tmp_t, e.g.

drwxrwxrwx wei wei user_u:object_r:httpd_tmp_t assets/

Use the chcon command to change the security context, e.g.

chcon -R -t httpd_sys_content_t *

more on http://wiki.centos.org/HowTos/SELinux

And more if you need mysql to work with apache, by default they can not communicate with each other

http://beginlinux.com/server_training/web-server/976-apache-and-selinux

SELinux is too pedantic.

this solved my problem:

chcon -v --type=httpd_sys_script_rw_t /path to/protected/runtime

Tanks!! this is a great solution!