Install and enable SuPHP on Plesk 9.x.x

Afdrukken
PDF
Gebruikerswaardering: / 0
LaagsteHoogste 

This howto will help you to configure SuPHP on your Plesk 9.x.x server running Debian 4

Install the SuPHP Package

  1. Update the APT system
    apt-get update
  2. 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)

  1. Edit the config file
    nano -w /etc/apache2/mods-available/suphp.conf
  2. 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
  3. Save the file and exit Nano
  4. 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

  1. Create the file
    touch /etc/apache2/conf.d/zzz_su_php.conf
  2. Edit the file
    nano -w /etc/apache2/conf.d/zzz_su_php.conf
  3. Fil the file with the correct content

           
                    AddHandler x-httpd-php .php .php3 .php4 .php5 .phtml
                    suPHP_AddHandler x-httpd-php
                    suPHP_Engine on
           
  4. Save the file and exit Nano

Edit the apache2 config file to load the module correctly

  1. Edit the file
    nano -w /etc/apache2/apache2.conf
  2. 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
  3. Restart Apache
    /etc/init.d/apache2 restart

How to check SuPHP is working

  1. 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);
    ?>
  2. 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!