SuPHP for PHP4 and PHP5 with ISPConfig

Discussion in 'Tips/Tricks/Mods' started by Rustin, Nov 28, 2006.

  1. Rustin

    Rustin New Member

    Another great Falko howto: http://www.howtoforge.com/apache2_suphp_php4_php5

    I'm wondering how to apply this feature in ispconfig.
    We are moving all our hosting customers to ISPConfig and would love to have the ability to select which handler is used on a per vhost/customer basis.

    I can't manually edit the vhost configs because if someone makes a change to the 'web' through the ISPConfig portal, the config will be rewritten, right?

    What I would like to do is have ISPConfig output:
    Code:
    suPHP_Engine on
    suPHP_UserGroup web1_username web1
    AddHandler x-httpd-php4 .php .php4
    AddHandler x-httpd-php5 .php5
    suPHP_AddHandler x-httpd-php4
    suPHP_AddHandler x-httpd-php5
    instead of the code below when the 'suphp' option is set in config.inc.php
    Code:
    suPHP_Engine on
    suPHP_UserGroup web1_username web1
    AddHandler x-httpd-php .php .php3 .php4 .php5
    suPHP_AddHandler x-httpd-php
    This way I could tell the end users to use a .php4 or .php5 extension on their files to decide which version of php to use.

    Can anyone see why this would not work? If not, does anyone know where in the ISPConfig source files the suphp code is specified so I can change it?

    Thanks in advance!

    Rustin
     
  2. Rustin

    Rustin New Member

    Figured it out.

    By changing /root/ispconfig/scripts/lib/config.lib.php:
    Code:
     if($go_info["server"]["apache2_php"] == 'suphp'){
                      $php .= "suPHP_Engine on\n";
                      $php .= "suPHP_UserGroup ".$webadmin." web".$web["doc_id"]."\n";
                      $php .= "AddHandler x-httpd-php .php .php3 .php4 .php5\n";
                      $php .= "suPHP_AddHandler x-httpd-php\n";
              }
    
    to:
    Code:
    if($go_info["server"]["apache2_php"] == 'suphp'){
                      $php .= "suPHP_Engine on\n";
                      $php .= "suPHP_UserGroup ".$webadmin." web".$web["doc_id"]."\n";
                      $php .= "AddHandler x-httpd-php4 .php .php4\n";
                      $php .= "AddHandler x-httpd-php5 .php5\n";
                      $php .= "suPHP_AddHandler x-httpd-php4\n";
                      $php .= "suPHP_AddHandler x-httpd-php5\n";
              }
    
    And following the Falko howto, it now will create vhost configs that suphp with php4-cgi and php5-cgi depending on the file extension (assuming you have the option enabled in /home/admispconfig/lib/config.inc.php).
    Maybe I should make a proper addition to the tips/tricks section?
     
  3. Berry

    Berry New Member

    Thanks for tipp, I was searching for this!
    Yes, add it to tips&tricks!
     

Share This Page