Server wide permission issue after enabling suphp

After enabling the suphp on the server,many time 500 Internal Server Error occur due to the incorrect permission,ownership and incorrect php module defined in the .htaccess file and we can’t make the changes manually therefore we can use the following script to make the all the changes server.

Login into the server as a root user and follow the followings steps.

linux7802@server[~]#cat /root/suphppermission.sh

#!/bin/bash

# Reset the directory permissions.
chmod 755 /opt/suphp
find /opt/suphp -type d -exec chmod 755 {} \;

# Reset permission,ownership for cPanel user
for user in `/bin/ls /var/cpanel/users`; do

chown -R ${user}:${user} /home/${user}/public_html
chmod 755 /home/${user}/public_html
find /home/${user}/public_html -type f -exec chmod 644 {} \;
find /home/${user}/public_html -type d -exec chmod 755 {} \;

# Remove php_values in the .htaccess file.
find /home/${user}/public_html -name ‘.htaccess’ -exec sed -ie ‘s/php_value/#php_value/’ {} \;
find /home/${user}/public_html -name ‘.htaccess’ -exec sed -ie ‘s/php_flag/#php_flag/’ {} \;
done

 

About Anant 386 Articles
Senior technical writer