Setting up suphp on an ISPConfig server

Discussion in 'HOWTO-Related Questions' started by Hans, Mar 4, 2007.

Thread Status:
Not open for further replies.
  1. Hans

    Hans Moderator Moderator

    For security reasons and to avoid problems with permissions, i would like to setup suphp on my Debian ISPConfig server.

    I have read http://www.howtoforge.com/apache2_suphp_php4_php5 with interest and i would like to know if it is compatible with my Debian ISPConfig server,
    which has been setup according Falko's howto at http://www.howtoforge.com/perfect_setup_debian_sarge.

    I think it is enough to setup suphp for php4 only, as i do not use php5 for my Apache2.

    One more question:
    If i want to use suphp, is it necesarry to add the following lines manually (on the shell) to the virtualhost file?

    suPHP_Engine on
    suPHP_UserGroup testuser test
    AddHandler x-httpd-php .php .php3 .php4 .php5
    suPHP_AddHandler x-httpd-php

    Or can it be done within ISPConfig via the Apache directives field or so?
     
    Last edited: Mar 4, 2007
  2. falko

    falko Super Moderator Howtoforge Staff

    I think so. :)

    I'd place it in the Apache Directives field.
     
  3. Hans

    Hans Moderator Moderator

    ISPConfig and suphp

    Falko/Till,

    Because i am very careful, i have a question about ISPConfig and suphp:

    Within the thread http://www.howtoforge.com/forums/showthread.php?t=9646&page=6&highlight=suphp is mentioned that it is necessary to change the file /home/admispconfig/ispconfig/lib/config.inc.php, which is part of ISPConfig. If that’s correct I will have problems, everytime I update ISPConfig to the next version.
    Is this the only way, how suphp can be setup on an ISPConfig server or is there another option?
     
    Last edited: Mar 6, 2007
  4. Hans

    Hans Moderator Moderator

    suphp works great with ISPConfig

    In the mean time, i've setup suphp on my Debian Sarge test-server successfully.
    I want you to know that suphp works great with ISPConfig!

    My next step is to do this also for my 2 production servers.
    This means that i need a close look to my vhost, because of the amount of existing sites.
    (The suphp directives for Apache are only added automaticly for new sites).
     
  5. falko

    falko Super Moderator Howtoforge Staff

    The updater takes care of your settings in config.inc.php, so that should be no problem. :)
     
  6. Hans

    Hans Moderator Moderator

    That's really nice Falko.

    ISPConfig is really great!
    I love it.

    The subject "suphp" is here and everywhere in the forums.
    Of course we have your howto, which is a great guide, but some details are a little bit different, if you like to run it on an ISPConfig server.

    For that reason and with your permission of course, i will write a small howto which explains how i did it. It will be based on your howto and the info which can be found within the forums on Howtoforge.
     
    Last edited: Mar 7, 2007
  7. falko

    falko Super Moderator Howtoforge Staff

    That would be great! :)
     
  8. Hans

    Hans Moderator Moderator

    From php4mod to php4-cgi+suphp

    Dear Till/Falko,
    Although, i've setup suphp successfully on my test-server with ISPConfig,i've some questions:

    After installing suphp:
    The webfolders are created with chmod 775 and not 755.
    The php-scripts have chmod 664 in stead of 644.

    For this reason, some php-script do not function in the beginning.
    They only work if the permissions are correct (of course).

    What can i do to set the permissions in 755 & 644 from the beginning?
    I guess, it has something to do with the permissions settings within /etc/suphp.conf, which are as follows:

    ; Security options
    allow_file_group_writeable=true
    allow_file_others_writeable=false
    allow_directory_group_writeable=true
    allow_directory_others_writeable=false

    After i installed suphp, I also did a test with an existing Joomla site.
    Then a problem occur, because of an internal server 500 error.
    I guess it has something to do with the permissions too, because suphp and php4-cgi are up and running.

    What can you recommend to volve this Internal server error 500?

    When i am finished with testing i have the plan to do an migration from php4 as a module to php4-cgi+suphp.
    Before i take such a step, i need to know how to solve the problems as described above.
    So your advise is appreciated.
     
  9. falko

    falko Super Moderator Howtoforge Staff

    What does your /etc/suphp.conf look like now?

    If you want to change parmissions, you'd have to modify the function make_docroot() in /root/ispconfig/scripts/lib/config.lib.php.
     
  10. Hans

    Hans Moderator Moderator

    Hi Falko,

    I will have a look at the line:
    make_docroot() in /root/ispconfig/scripts/lib/config.lib.php and i will report about my experience with it.

    I think it is very important to set the right permissions, otherwise there will be a lot of problems on a server with a lot of (CMS)-websites, which make use of php.

    The contents of /etc/suphp.conf on my test-server looks like this:

    [global]
    ;Path to logfile
    logfile=/var/log/suphp.log

    ;Loglevel
    loglevel=info

    ;User Apache is running as
    webserver_user=www-data

    ;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=false

    ;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/php4-cgi

    ;Handler for CGI-scripts
    x-suphp-cgi=execute:!self
     
  11. Hans

    Hans Moderator Moderator

    Joomla with php4-cgi+suphp with ISPConfig

    Suphp is very nice for Content Management Systems (CMS), like Joomla.
    So i'm busy to test Joomla with php4-cgi and suphp.

    Then i dicovered something i did not expect:
    A connection with the database, which is created within ISPConfig, can not be established. The pre-installer shows that MySQL is not supported
    (See first picture for details).

    That suphp is working and that permissions are ok, can be shown in the other pictures.
    (I've changed the ISPConfig default folder permissions from 775 to 755 and php-files from 664 to 644).
    If i don't do that an internal server 500 error appears and php-scripts don't work.

    My question for this step is:
    What about MySQL? Do i need an extra module to run MySQL with php4-cgi?
    Any advise is apreciated!
     

    Attached Files:

    Last edited: Mar 9, 2007
  12. falko

    falko Super Moderator Howtoforge Staff

    Looks ok, suPHP shouldn't complain about group writable files/directories... :confused:

    When you run PHP's phpinfo() function, do you see MySQL support in the output?
     
  13. falko

    falko Super Moderator Howtoforge Staff

    There's no MySQL support in your php4-cgi. You can try to find a package for it like this:
    Code:
    apt-cache search php|grep mysql
     
  14. Hans

    Hans Moderator Moderator

    Got it!

    I have Joomla up and running now on the test-server with ISPConfig with suphp enabled! (:))))

    Thank you Falko for your feedback!
    Soon i write the howto, which shows how i did it.
     
  15. Hans

    Hans Moderator Moderator

    How to setup suPHP on a Debian based ISPConfig server

    Falko,

    After testing suPHP on my ISPConfig server, i've posted my howto called:
    "How to setup suPHP on a Debian based ISPConfig server"

    As promised! :)
     
  16. brengo

    brengo New Member

    Thank you Hans! Now I can follow someone who has mastered the little problems :) Great!
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    Thank you very much for the howto :)
     
  18. falko

    falko Super Moderator Howtoforge Staff

    Great, thanks! :)
    I'll publish it in the next days.
     
  19. falko

    falko Super Moderator Howtoforge Staff

  20. Hans

    Hans Moderator Moderator

    Thanks for publishing! :)

    I close this thread now, because the steps to be taken to setup suPHP on a Debian based ISPConfig server can be read within the howto.
     
Thread Status:
Not open for further replies.

Share This Page