CakePHP needs to change owner of temp folders like this: http://book.cakephp.org/2.0/en/getting-started.html#tmp-directory-permissions
# chown -R username app/tmp
When I use Apache with mod_php
, username must be apache
.
When I use Apache with mod_fcgid
, username must be myswebsiteuser
.
I need to make some tryouts to check the performance of the fcgid
vs. mod_php
. So When I switch the php type, I get tons of errors in minutes. I run script that changes owner of the folder from apache to mywebsiteuser, remove old temporary files and wait cakephp to create new ones with new user. I need to combine old and new log files also.
It seems like chown permits to set user groups. Is there a way to set "tmp" folders so they can be used in mod_php and mod_fcgid, without switching owners ?
(I own the server, it has CentOS and it has only one website. Also Plesk 11.5)
Similar: What are the right ownership & permissions to the CakePHP app/tmp folder for production?
First create a group:
# groupadd mygroup
Open the groups file:
# vi /etc/group
In the last line there exists a line like this:
mygroup:x:510:
Look for the username of the mod_fcgid, if you website is mywebsite.com, then possibly it is "mywebsite".
You need to add 2 users to your new group "apache" and "mywebsite".
mygroup:x:510:apache,mywebsite
Now change owner and mod of the folders like this:
# chown -R mywebsite:mygrup /var/www/vhosts/mywebsite.com/httpdocs/app/tmp/
# chmod -R 664 /var/www/vhosts/mywebsite.com/httpdocs/app/tmp/
Now temp folder is both writeable by mod_php (apache) mod_fcgid (mywebsite).