fc6 + ISPConfig + suphp

Discussion in 'Installation/Configuration' started by zetnsh, Aug 18, 2007.

  1. zetnsh

    zetnsh New Member

    Hi guys,

    I've managed to get ISPConfig working, all but the suphp part! I enabled this by editing the appropriate line of /home/admispconfig/ispconfig/lib/config.inc.php as follows:

    Code:
    $go_info["server"]["apache2_php"] = 'suphp';
    Incidentally, I tested my suphp setup and it worked fine before the ISPConfig install.

    I've looked at the instructions on http://www.howtoforge.com/suphp_debian_ispconfig which doesn't quite apply because I'm on Fedora Core 6, and it's very helpful. However, something wierd is happening when I create a new virtual host.

    If I create a new php-enabled virtual host I end up with a Vhosts_ispconfig.conf_????? file which contains references to suphp, but the actuall Vhosts_ispconfig.conf file which is linked from httpd.conf doesn't contain reference to the vhosts file with the date stamp.

    Not quite sure where to go from here - the only thing I could think of is that I needed to compile mod_suphp manually with the couple of changed lines mentioned in the debian howto - I just did

    Code:
    yum install mod_suphp
    Any ideas?

    Thanks,

    Neil Hamilton
    Web Outreach
     
  2. ceesco53

    ceesco53 New Member

    RE: SuPHP on CentOS 5 same problem

    I'm using centos 5 and recompiled the suphp rpm. I'm getting the same problem. A config with a timestamp with proper suphp references in the virtualhosts, but the actual vhost config file remains using the old php settings. Logically there must be something else that needs to be changed, but what? Im using Ispconfig 2.2.15 with remoting enabled just fine otherwise.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The mod_suphp that v´can be isntalled with yum is not compatible with ISPConfig. You will have to compile a new suphp binary with the changes mentioned in the debian howto. There will be a howto published for compiling suphp for fedora + centos and ispconfig next week.
     
  5. zetnsh

    zetnsh New Member

    Thanks Tim,

    Now httpd -t gives:

    Code:
    Syntax error on line 33 of /etc/httpd/conf/vhosts/Vhosts_ispconfig.conf:
    Invalid command 'suPHP_UserGroup', perhaps misspelled or defined by a module not included in the server configuration
    Which I guess would be sorted by recompiling suphp from the sources. I'll have a look at the Debian-based solution and see how I get on!

    Neil
     
  6. zetnsh

    zetnsh New Member

    An update: nearly there!

    Right - very nearly got it, just one last problem :)


    Having unpacked the suphp-0.6.2 source to /root, this is what I did to install suphp:

    Code:
    cd /root/suphp-0.6.2
    As per the debian howto, I replaced the lines 324/325 with these two lines below:

    Code:
    AP_INIT_ITERATE("suPHP_AddHandler", suphp_handle_cmd_add_handler, NULL, RSRC_CONF | ACCESS_CONF, "Tells mod_suphp to handle these MIME-types"),
    
    AP_INIT_ITERATE("suPHP_RemoveHandler", suphp_handle_cmd_remove_handler, NULL, RSRC_CONF | ACCESS_CONF, "Tells mod_suphp not to handle these MIME-types"),
    I then encountered a problem building suphp - It kept complaining about various LIBTOOL errors. So - I then edited the file configure.ac and added the following line:

    Code:
    AC_PROG_LIBTOOL
    Then I ran:

    Code:
    aclocal
    autoconf
    ./configure --prefix=/var --sysconfdir=/etc --with-apache-user=apache --with-setid-mode=paranoid --with-apxs=/usr/sbin/apxs --with-apr=/usr/bin/apr-1-config
    make
    make install
    I then made a copy of the template config file:

    Code:
    cp /root/suphp-0.6.2/doc/suphp.conf-example /etc/suphp.conf
    And changed a few settings, so the file was as follows:

    Code:
    [global]
    ;Path to logfile
    logfile=/var/log/suphp.log
    
    ;Loglevel
    loglevel=info
    
    ;User Apache is running as
    webserver_user=apache
    
    ;Path all scripts have to be in
    docroot=/
    
    ;Path to chroot() to before executing script
    ;chroot=/mychroot
    
    ; Security options
    allow_file_group_writeable=true
    allow_file_others_writeable=false
    allow_directory_group_writeable=true
    allow_directory_others_writeable=false
    
    ;Check wheter script is within DOCUMENT_ROOT
    check_vhost_docroot=true
    
    ;Send minor error messages to browser
    errors_to_browser=true
    
    ;PATH environment variable
    env_path=/bin:/usr/bin
    
    ;Umask to set, specify in octal notation
    umask=0077
    
    ; Minimum UID
    min_uid=100
    
    ; Minimum GID
    min_gid=100
    
    
    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php
    
    ;Handler for CGI-scripts
    x-suphp-cgi=execute:!self
    I have to say this nearly worked - after making a change to one of the vhosts, the suPHP declarations were back in /etc/httpd/conf/vhosts/Vhosts_ispconfig.conf which was nice.

    The trouble is, I'm now getting internal server error when trying to run a script, the error being "premature end of script headers" and I can't see how to debug that at the moment!

    If someone else has the answer, let me know, otherwise if I find it, I'll post here!
     
  7. falko

    falko Super Moderator Howtoforge Staff

    Any errors in Apache's error log?
     
  8. zetnsh

    zetnsh New Member

    Nothing very informative I'm afraid :( Just this:

    Code:
    [Tue Aug 21 16:15:46 2007] [error] [client 88.97.179.134] Premature end of script headers: test.php
    If I knew what random error message was being output before the headers, that would be a start!

    FYI, the script simply contains this:

    Code:
    <?php
    print "TESTING FILE WRITE:<br>\n";
    unlink("/tmp/test.txt");
    $handle = fopen("/tmp/test.txt","a");
    print ($handle);
    fwrite($handle,"TESTING");
    fclose($handle);
    print "RESULT:<pre>\n";
    system("ls -al /tmp/test.txt");
    print "</pre>\n";
    print "This should be owned: web1_mail web1<br>\n";
    ?>
    It runs fine from the CLI needless to say...
     
  9. falko

    falko Super Moderator Howtoforge Staff

  10. zetnsh

    zetnsh New Member

    Just to let you know, I followed your advice and tried out Oliver's HOWTO for suPHP.

    Now - I'm using Fedora Core 6 rather than Fedora 7 (that's what my dedicated server came with, and I haven't got the bottle to do a complete system upgrade including Kernel reinstallation on an O/S I am a little unfamiliar with!)

    I have rebuilt my server from scratch using the "The Perfect Server - Fedora 7" - the short answer, is that it worked, with a couple of points to note, for Fedora Core 6:

    BEFORE Step 4, if installing suPHP as per http://www.howtoforge.com/suphp_fedora7_centos5_with_ispconfig, make sure you have the apache header files installed:
    Code:
    yum install httpd-devel
    In Step 6, Change the command to:
    Code:
    Change to system-config-securitylevel-tui
    Oh - one final note on ISPConfig - make sure you have this set as below in /etc/suphp.conf:
    Code:
    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php-cgi
    I had it set to /usr/bin/php before, and I think that's where my internal server errors were coming from.

    In conclusion, it works well, suPHP is doing it's thing, and I'm a happy bunny! (Apart from suexec - that's another story, another post :)

    Thanks everyone for your help.

    Neil
     
    Last edited: Aug 22, 2007
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    If you have suphp installed, you dont need suexec anymore as suphp execute cgi scripts too, if you configure the handlers in suphp.conf
     
  12. zetnsh

    zetnsh New Member

    Thanks for that Till,

    I thought that was probably the case. Do you know what I need to set in suphp.conf in order to do that? This is what I currently have:

    Code:
    [global]
    ;Path to logfile
    logfile=/var/log/httpd/suphp.log
    
    ;Loglevel
    loglevel=info
    
    ;User Apache is running as
    webserver_user=apache
    
    ;Path all scripts have to be in
    docroot=/
    
    ;Path to chroot() to before executing script
    ;chroot=/mychroot
    
    ; Security options
    allow_file_group_writeable=true
    allow_file_others_writeable=false
    allow_directory_group_writeable=true
    allow_directory_others_writeable=false
    
    ;Check wheter script is within DOCUMENT_ROOT
    check_vhost_docroot=true
    
    ;Send minor error messages to browser
    errors_to_browser=true
    
    ;PATH environment variable
    env_path=/bin:/usr/bin
    
    ;Umask to set, specify in octal notation
    umask=0077
    
    ; Minimum UID
    min_uid=100
    
    ; Minimum GID
    min_gid=100
    
    
    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php-cgi
    
    ;Handler for CGI-scripts
    x-suphp-cgi=execute:!self
    Do I need to do something to the Apache configs in order to get CGI scripts working - like add a handler somewhere?

    Thanks again,

    Neil
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    I'am not sure about the settings, i would try to change the line:

    x-suphp-cgi=execute:!self

    to:

    cgi-script=execute:!self

    and enable the cgi checkbox in ispconfig in the website settings. You might have to disable mod_cgi in your apcahe configuration, so that you do not get any conflicts.

    Another solution might be to let suphp.conf untouched, disable the cgi checkbox in the website settings in ispconfig and set the addhandlers manually by adding the following lines in the apache directives field of the website:

    ScriptAlias /cgi-bin/ /var/www/web1/cgi-bin
    AddHandler x-suphp-cgi .cgi
    AddHandler x-suphp-cgi .pl

    You will have to replace the path to the cgi-bin directory with the proper path for the website.
     
  14. zetnsh

    zetnsh New Member

    Reposting under new thread to avoid confusion!
     

Share This Page