SuPHP is an option during compiling PHP to run all scripts under the owner of the folder. Traditionally on shared hosting accounts, PHP scripts are run as “nobody” to prevent them from causing havoc with the system. However, this still leaves a few vulnerabilities where a PHP script from one user might be able to access other user’s files. By running the script as the owner, the Linux user permissions system is correctly invoked – users can only edit and effect their own files.

However, having recently recompiled PHP and Apache on cPanel to enable suexec support, I came across a problem where pages would give an internal server error (Error 500). This was caused by one of the following;

  • php_flag in .htaccess
  • php_value in .htaccess
  • Permissions on PHP scripts not set to 644
  • Permissions on public_html folder not set to 771

Due to the nature of suexec, php_flag and php_value will not work! Instead you need to set suPHP_ConfigPath in your htaccess to the path where your own php.ini can be found (Note, this is just the path to php.ini, not the full location of php.ini).

suexec will also not execute any scripts with insecure permissions, such as 777. Set all PHP scripts to 644.

Once you’ve taken into account these issues, your PHP should be running in a more secure fashion. Under cPanel/WHM you can enable suphp by going to the EasyApache option which will recompile PHP and Apache – this is not a task to be taken lightly ensure you know what you are doing before, during and after using EasyApache to recompile PHP and Apache. If after recompiling you encounter errors caused by the above you can temporarily set the PHP handler to dao on cPanel instead of suphp.

You may also like...

1 Response

  1. Rodrigo says:

    One more:

    If size of /usr/local/apache/logs/suphp_log is more than 2gb, you get a beautiful error500 !!


Leave a Reply

Your email address will not be published. Required fields are marked *