By default all the Plesk servers runs mod_php for speed. This has one major drawback and that is that if a clients creates files via PHP, they are owned by the webserver user under which mod_php runs. The solution to the problem seems to enable suPHP for the clients that needs to create files via PHP.
Below is the procedure that I found to work:
- Download the mod_php RPM from the Dag Wiers repository:
- Install the mod_php RPM:
rpm -Uvh mod_suphp-0.6.1-2.1.el3.rf.i386.rpm
- Disable able the mod_suphp
- Your /etc/httpd/conf.d/suphp.conf, should only have the following lines:
LoadModule suphp_module modules/mod_suphp.so
LoadModule php4_module modules/libphp4.so
Putting the above into your config will default to PHP pages being run by mod_php.
- To switch a virtual host over to mod_suphp, use the following:
php_admin_flag engine Off
suPHP_AddHandler x-httpd-php .php
AddHandler x-httpd-php .php
suPHP_UserGroup <USER> <GROUP>
The config above will only activate if both mod_php and mod_suphp is loaded. Remember to replace the <VHOST>, <USER> and <GROUP> entries with the correct virtual host, Unix user and Unix group.
EDIT: In later versions of PHP, the CLI and CGI version are 2 separate binaries. You now need to edit the
/etc/suphp.conf file to reflect the correct binary in the
x-httpd-php=php:/usr/bin/php-cgi entry. To determine which binary you need to add, simple do a
php -v on the command line. The binary that outputs the cgi information as part of the version information, is the correct binary.