Friday, January 28, 2011

500 internal error suphp

Steps:

(Set suPHP as default : "WHM Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration")

1. check "tail -f /usr/local/apache/logs/error_log"

2. PHP files should must not be set to 0666 or 0777 permissions. Instead, they should be set to the standard of 0644. Directories should be 0755.

3. PHP Files/directories must be owned by the account username, rather than by "nobody" or "root".

/scripts/chownpublichtmls to fix that problem

4. PHP directives should not be mentioned in the .htaccess file. You will have to place/create php.ini under the domains who want to set their own values for php directives.

5. "php_flag" and "php_value" entries in the .htaccess must be removed, and a php.ini should be used in the account instead for any custom values.

6. You can use the following command to check for accounts using those values in their .htaccess files:

find /home*/*/public_html/ -mindepth 1 -iname "\.htaccess" -type f -exec grep -Hi "^php_*a*" '{}' \;

7. Below are some commands you can run to change all permissions all at once. These commands must be ran at your own risk, as it is not easily reversible if you decide to switch back to DSO.

find /home*/*/public_html/ -mindepth 1 -perm 0777 -type d -exec chmod -c 0755 '{}' \;

find /home*/*/public_html/ -mindepth 1 -perm 0666 -type f -exec chmod -c 0644 '{}' \;

find /home*/*/public_html/ -mindepth 1 -perm 0777 -type f -exec chmod -c 0644 '{}' \;


8. For ownership:

for i in `ls /var/cpanel/users/`; do chown -R $i:$i /home/$i/public_html ; done

Then make sure the ownership of the public_html directory is correct via the
following command:

for i in `ls /var/cpanel/users/`; do chown $i:nobody /home/$i/public_html ; done

9. check the size of the logs (suphp_logs)

ls -lh /usr/local/apache/logs/suphp_log

If it was 2GB then execute the following command

echo > /usr/local/apache/logs/suphp_log

No comments:

Post a Comment