|
04 februari 2009
This howto will help you to configure SuPHP on your Plesk 9.x.x server running Debian 4
Install the SuPHP Package
- Update the APT system
apt-get update - Install the SuPHP package from the APT sources
apt-get install libapache2-mod-suphp
Change the config file so SuPHP will not affect all scripts (like webmail)
- Edit the config file
nano -w /etc/apache2/mods-available/suphp.conf - Change the first lines of the config file from this:
AddHandler x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler x-httpd-php
suPHP_Engine on
To this (comment out!):
# AddHandler x-httpd-php .php .php3 .php4 .php5 .phtml
# suPHP_AddHandler x-httpd-php
# suPHP_Engine on - Save the file and exit Nano
- Restart Apache
/etc/init.d/apache2 restart
If you check the /etc/suphp/suphp.conf file, you'll discover that SuPHP is configured by default to act for the complete /var/www folder. The Plesk VHosts are in the /var/www/vhosts folder, and we need to have SuPHP only to act for this folder.
Create a new config file for Apache module SuPHP
- Create the file
touch /etc/apache2/conf.d/zzz_su_php.conf - Edit the file
nano -w /etc/apache2/conf.d/zzz_su_php.conf - Fil the file with the correct content
AddHandler x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler x-httpd-php
suPHP_Engine on
- Save the file and exit Nano
Edit the apache2 config file to load the module correctly
- Edit the file
nano -w /etc/apache2/apache2.conf - Add the following lines at the BOTTOM of the config file
php_admin_flag engine on
suPHP_Engine On
AddHandler x-httpd-php .php .php4 .php3 .php5 .phtml
suPHP_AddHandler x-httpd-php - Restart Apache
/etc/init.d/apache2 restart
How to check SuPHP is working
- Create a file in a websites HTTPDOCS called "file.php" and fill with the following lines
$f = fopen ("test.txt", "a");
fputs($f, "it's working !");
fclose($f);
?> - Run the script from a webbrowser and check the permissions on the file "test.txt" with SSH, the owner should be the user owning the domain.
If you have any questions related to this article, please contact me!


