I wanted to check that suPHP was working correctly and executing scripts under a specific user id.

This little PHP script did the trick.

php echo ‘whoim = ‘.exec(‘/usr/bin/whoami’);

That echo’d (outputted) the result of running a file /user/bin/whoami

I had a frustrating error for a while when using suPHP. It kept giving error 500 when enabling mod_suphp for .php files:

Directory /var/www is not owned by user

Of course, the directory was not owned by the user. The user belonged to a sub-directory only, the reason behind using suPHP.

It turned out to solve this the directory /var/www had to be owned by user root. That fixed the error.

I was configuring an apache2 setup to work with suPHP and ran into various Internal Server Error 500s due to folders and files having too generous permissions on them. suPHP doesn’t like that.

These two commands, when run from the directory where the web files reside, will recursively reset the permissions as required.

Find files and set to permissions 644

sudo find . -type f -exec chmod 644 {} \;

Find folders and set to permissions 755

sudo find . -type d -exec chmod 755 {} \;