Nginx with Apache and suPHP on cPanel

Recently I was testing nginx as a proxy for Apache and PHP on cPanel installation. I came a cross nginxadmin plugin for cPanel, By default Apache is configured in WHM to run PHP in SuPHP mode. After installing nginxadmin I wanted to test index.php on my test website but I got error message saying “500 Internal Server Error”. Index.php is just calling phpinfo() function.

Looking at the error_log revealed the following:

[Sat Jan 19 14:12:06 2013] [error] [client 192.168.1.200] SoftException in Application.cpp:256: File “/home/user/public_html/index.php” is writeable by group
[Sat Jan 19 14:12:06 2013] [error] [client 192.168.1.200] Premature end of script headers: index.php



So the solution is to make chmod 640 on /home/user/public_html/index.php file or to tweak SuPHP settings to allow files with group writable permissions.

If you don’t want to change file permissions on every .php file you can change the setting in /opt/suphp/etc/suphp.conf file. Find the line ‘allow_file_group_writeable=false‘ and change the parameter value to true.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License unless otherwise noted.

Creative Commons License