suPHP is a tool for executing PHP scripts with the permissions of their owners. It consists of an Apache module (mod_suphp) and a setuid root binary (suphp) that is called by the Apache module to change the uid of the process executing the PHP interpreter.
1. Install suPHP
apt-get install libapache2-mod-suphp
2. Disable the php5 apache module
3. Restart Apache
4. You can test if suPHP is working correctly by creating a php file containing the following lines:
The script will return user/group id and name. Make sure you set the file owner to a user/group with id greater than 99.