I have many domains on my virtuamin box, most of them running with FCGId (run as virtual server owner), and Joomla.
Today, a few servers started to fail with an error 500. Checking the error log I have:
[Wed Jan 04 19:48:21 2012] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Jan 04 19:48:21 2012] [error] [client 186.204.132.148] Premature end of script headers: index.php
Changing the “PHP script execution mode” to Apache mod_php (run as Apache’s user), solved the problem for the moment. If I change back to FCGId I get the error 500 again.
What can I do fix it? It is best to run PHP with FCGId, right?
The problem is “chmod 775 * -R” was run on the /home directory. So every folder and file for all virtual severs now has 775 permissions, except the fcgi-bin folders that I changed to 755 to put the websites back online.
I’m concerned about security. I can’t leave the permissions like that, can I?
Well, it would be difficult to fix all the files/directories in that hierarchy – but what you could do is go into /home, and set all the directories there to “700”. That would make it so that, regardless of what the files/directories under there are set to, folks who shouldn’t be able to view them wouldn’t have access.
Dirs without php files doesn’t matter can be 777 or whatever you need.
Change all permissions for folders from 777 to 755
execute in shell:
find /home//public_html -type d -exec chmod 755 {} ;
Change all permissions for files from 666 to 644 find /home//public_html -type f -exec chmod 644 {} ;
another problem is .htaccess clean all php_value and php_flag
find /home -type f -name ‘.htaccess’ -exec grep -Hrn ‘php_value’ ‘{}’ ;
find /home -type f -name ‘.htaccess’ -exec grep -Hrn ‘php_flag’ ‘{}’ ;
Check your php.conf
If you have fileuploader, by default FCGI only upload 100k, need changes in
FcgidMaxRequestLen 5120000