Internal Server Error

Internal Server Error

The 500 Internal Server Error message might be seen in any number of ways because each website is allowed to customize the message. Internal server errors can be caused by a few different things. Please check the Error Logs in cPanel for specific information. Lest learn Internal Server Error issue

SuPHP Permission Issue

suPHP enhances overall server security. When data migrating from a server that is not running suphp to a server running these, permission and ownership issues occur. When you access your domain you usually see

Error :- Internal Server Error

Tail the Apache error logs to see what the error is

# tail -f /usr/local/apache/logs/error_logs

You can see the error

[Thu Sep 27 15:35:30 2012] [error] [client XXX.XXX.XXX.XXX] SoftException in Application.cpp:601: Directory “/home/youknowlinux/public_html/test.php” is writeable by group
[Thu Sep 27 15:35:30 2012] [error] [client XXX.XXX.X.X] Premature end of script headers:
The script fail if the php file or folder is writable for anyone other that the owner. Check the permission and ownership .

# cd /home/youknowlinux/public_html/
# ll | grep test.php
-rwxrwxrwx 1 nobody nobody 158 2012-09-27 04:32 test.php

That shows test.php has full permission and is not owned by the user . Change the permission and ownership.

# chmod 644 test.php
# chown youknowlinux.youknowlinux test.php

If it is a server wide issue , then its difficult to change it for each user . Here is a script (for cpanel servers) that fixes all the files and folder permissions that occurs when server changes to suphp.

1) Save the script to a file .
# vi /root/fixperms.sh

#!/bin/bash
for user in `ls /var/cpanel/users`; do
chown ${user}:${user} /home/${user}/public_html
chmod 755 /home/${user}/public_html
find /home/${user}/public_html -group nobody -print0 | xargs -0 chgrp ${user}
find /home/${user}/public_html -type f -print0 | xargs -0 chmod 644
find /home/${user}/public_html -type d -print0 | xargs -0 chmod 755
done

2) Make the script executable.
# chmod u+x /root/suphpfix.sh

3) Execute the script
# bash /root/fixsuphp.sh

Bookmark the permalink.

Comments are closed.