Just for my own note :)
After installing suPHP on server, execute :
find /home/*/public_html -type d -exec chmod 755 {} \;
This command fix all folder permission

find /home/*/public_html -name '*.php' -o -name '*.php[345]' -o -name '*.phtml'| xargs chmod -v 644
This command fix all file permission

#!/bin/bash
cd /var/cpanel/users
for user in *
do
chown -R $user.$user /home/$user/public_html/*
done

This script fix all ownership issue

2 Responses to “Fixing File and Folder Permission on suPHP”


  1. THANK YOU THANK YOU THANK YOU!

    I’ve been pulling my hair out for a couple days trying to get my scripts to work with suphp turned on. This simple script you put up to change permissions on the folders did the trick.

    The third script worked for me as well, but the second script left me at a prompt like this: >
    seemed to be waiting for input. When I saved it as a shell script I got an error too, something like “unexpected termination”

    Still my scripts are working, thank you for posting that!

  2. DBI Hosting Says:

    Retroflick.com

    The reason you are getting the prompt is because that command has mixed quotes that do not properly terminate.

    The original command had parts of the option quoted with ‘ and terminated with ‘

    The correct command is:

    find /home/*/public_html -name ‘*.php’ -o -name ‘*.php[345]‘ -o -name ‘*.phtml’| xargs chmod -v 644


Leave a Reply