Something Different In Linux

Home » cpanel » Internal Server Error

Internal Server Error

Posted by Rishikesh Vispute Categories: cpanel, PHP

SuPHP Permission Issue

suPHP enhances overall server security. When 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


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 Jul 12 09:00:09 2007] [error] [client XXX.XXX.X.X] SoftException in Application.cpp:601: Directory “/home/user/public_html/test.php” is writable by group .

[Thu Jul 12 09:00:11 2007] [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/user/public_html/

# ll | grep test.php

rwxrwxrwx 1 nobody nobody 158 2008-05-13 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 user.user 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/

     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

2) Make the script executable.

# chmod u+x /root/

3) Execute the script

# bash /root/

4 Responses so far.

  1. Anon sysadmin says:

    And what if there are cPanel accounts on say, /home and /home2? You should not be assuming /home.

Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...