1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

How to suphp 0.6.1

Discussion in 'Plesk for Linux - 8.x and Older' started by BDMM, Feb 18, 2006.

  1. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    Here we go

    DOWNLOAD AND INSTALL

    wget http://www.suphp.org/download/suphp-0.6.1.tar.gz
    tar -zxvf suphp-0.6.1.tar.gz
    cd suphp-0.6.1
    ./configure --with-prefix=/usr --with-apxs=/usr/sbin/apxs --with-min-uid=500 --with-min-gid=500 --with-apache-user=apache --with-php=/usr/bin/php --with-setid-mode=owner --prefix= --exec-prefix=/usr
    make
    make install

    I did have a few problems with the makefile not adding the conf files so added manually

    pico /etc/suphp.conf

    [global]
    logfile=/var/log/httpd/suphp_log
    loglevel=info
    webserver_user=apache
    docroot=/
    env_path=/bin:/usr/bin
    umask=0077
    min_uid=500
    min_gid=500

    ; Security options
    allow_file_group_writeable=false
    allow_file_others_writeable=false
    allow_directory_group_writeable=false
    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

    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php

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


    I modified this so that I could enable it on virtual sites only through the vhost.conf files.

    pico /etc/httpd/conf.d/suphp.conf

    # This is the Apache server configuration file providing suPHP support.
    # It contains the configuration directives to instruct the server how to
    # serve php pages while switching to the user context before rendering.

    LoadModule suphp_module modules/mod_suphp.so

    # This option tells mod_suphp if a PHP-script requested on this server (or
    # VirtualHost) should be run with the PHP-interpreter or returned to the
    # browser "as it is".
    suPHP_Engine off


    Then to enable on a per domain/directory basis. If you have problems with sitebuilder or horde I would suggest you check out other threads to disallow directories. I only enable it on admin directories because this is basically where files get uploaded or modified.

    pico /home/httpd/vhosts/<domain>/conf/vhost.conf

    ADD

    <Directory /home/httpd/vhosts/<domain>/httpdocs/<directory>
    php_admin_flag engine on
    suPHP_Engine On
    suPHP_ConfigPath "/etc/phpvirtual/<domain>"
    #suPHP_UserGroup owner group ## ONLY FOR paranoid MODE
    AddHandler x-httpd-php .php
    AddHandler x-httpd-php .php .php4 .php3 .phtml
    suPHP_AddHandler x-httpd-php
    </Directory>


    And finally create a directory to store php.ini files. I suppose it could be in the conf directory however I chose to create a seperate directory under /etc/phpvirtual/<domain.com>

    cp /etc/php.ini /etc/phpvirtual/<domain.com>/php.ini

    Modify the new php.ini as needed.

    Thats it.

    Alternatively you could install the [dag] mod_suphp via yum. This is compiled in paranoid mode and you will need to modify the suphp.conf files accordingly. I did have some problems with Handlers.


    BD
     
  2. xtreme2490

    xtreme2490 Guest

    0
     
    It seems i dont have apxs installed ?

    I'm running Plesk 7.5.4 on RH 9.0

    Anyone else ?
     
  3. eilko

    eilko Regular Pleskian

    28
    73%
    Joined:
    Aug 1, 2001
    Messages:
    468
    Likes Received:
    4
    Location:
    Enschede, Netherlands
    make sure you have the httpd-devel rpm package installed
     
  4. xtreme2490

    xtreme2490 Guest

    0
     
    I've installed the httpd-devel rpm now , and now i get following :

    configure: error: APR is needed to build mod_suphp for Apache 2.x but was not found

    How to proceed ?


    Thanks in advance for your help
     
  5. eilko

    eilko Regular Pleskian

    28
    73%
    Joined:
    Aug 1, 2001
    Messages:
    468
    Likes Received:
    4
    Location:
    Enschede, Netherlands
    install apr rpm
     
  6. xtreme2490

    xtreme2490 Guest

    0
     
    > rpm -q apr
    apr-0.9.7-1

    Is installed now.
    Same deal
    Still saying apr is needed ?
     
  7. w0uter

    w0uter Guest

    0
     
    I have installed suPHP on my suse 9.3 box. But after make install there was no conf file in /etc. Is that normal ?

    The second problem that i have is that php is useing cli. Do i need to re compile php for the cgi mode ?
     
  8. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    It seems that way. Follow the instructions above from the pico /etc/suphp.conf which creates the suphp.conf file.

    You may also need to add the /etc/httpd/conf.d/suphp.conf file

    Not sure on this one.
     
  9. w0uter

    w0uter Guest

    0
     
    I have made both conf files. But suPHP dont do anything.... I think i first most find out if i have to recompile PHP for the cgi mode.

    I see this in the phpsu faq:
    But i dont understand what i most copy...
     
  10. wkonline

    wkonline Guest

    0
     
    Hi!
    When i activate suPHP, then my PHP files get an 500 Internal Server Error. What could be wrong ?
     
  11. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    in the suphp.conf file you may have to set it to use php-cgi depends on which version of php you are using

    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php-cgi
     
  12. wkonline

    wkonline Guest

    0
     
    this line i have allready in my suPHP.conf.
    when its activated i get an 500 error
    when its not activated i get also a 500 error...
     
  13. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    what does
    locate php-cgi
    give you
     
  14. wkonline

    wkonline Guest

    0
     
    ups! php is not installed as cgi, when php-cgi is not there?
    can you give me a hint, how to compile php as cgi?
     
  15. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    I upgraded to atomicrockets php 5.0.4.

    However try changing the suphp.conf file to

    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php

    ie non cgi version.

    Did you follow the instructions from thread to setup suphp? where are you suphp.conf files

    /etc/suphp.conf
    /etc/httpd/conf.d/suphp.conf
     
  16. wkonline

    wkonline Guest

    0
     
    yes, i have followed the instructions.
    i have one suPHP.conf in /etc and one in /etc/apache2/conf.d

    in the suPHP.conf i have tried:

    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php

    and

    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php4
     
  17. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    These are my files running with standard plesk php

    /etc/suphp.conf
    ================

    [global]
    logfile=/var/log/httpd/suphp_log
    loglevel=info
    webserver_user=apache
    docroot=/
    env_path=/bin:/usr/bin
    umask=0033
    min_uid=500
    min_gid=500

    ; Security options
    allow_file_group_writeable=false
    allow_file_others_writeable=false
    allow_directory_group_writeable=false
    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

    [handlers]
    ;Handler for php-scripts
    x-httpd-php=php:/usr/bin/php

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


    /etc/httpd/conf.d/suphp.conf
    ==========================
    LoadModule suphp_module modules/mod_suphp.so
    suPHP_Engine off
    ==========================

    and my vhost.conf file for the site I want php to work in

    ============================
    <Directory /home/httpd/vhosts/domain.com/httpdocs>
    php_admin_flag engine on
    suPHP_Engine On
    suPHP_ConfigPath "/etc/phpvirtual/domain.com"
    AddHandler x-httpd-php .php
    AddHandler x-httpd-php .php .php4 .php3 .phtml
    suPHP_AddHandler x-httpd-php
    </Directory>
    ============================

    And I also have php.ini file in
    /etc/phpvirtual/domain.com/php.ini

    Also what version of php are you using and is it in /usr/bin folder
     
  18. wkonline

    wkonline Guest

    0
     
    Hi,

    thanks!

    My suPHP.conf:
    My vhost.conf:
    my /etc/apache2/conf.d/suphp.conf
    An i also have a /etc/phpvirtual/domain.com/php.ini

    By the Way:
    i have also a little other problem with php.
    Things like Horde a perfect in functionality. But i have several problem with scripts. when i want to open them, i'll get a download prompt. i have a info.php and a test123.php. both have this code:

    <? phpinfo() ?>

    the test123.php shows me the php infopage. the info.php wanted to be downloaded....

    when i want to use php without suPHP, i have to insert the following code to the vhost.conf:

    i have upgraded my php to 4.4.4. so i think there a several problems,...
     
  19. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1
    try changing

    LoadModule suphp_module /usr/lib/apache2/modules/mod_suphp.so

    to

    LoadModule suphp_module modules/mod_suphp.so

    If I recall I had some issues with this until I changed the path.
     
  20. BDMM

    BDMM Basic Pleskian

    24
    90%
    Joined:
    Apr 28, 2005
    Messages:
    31
    Likes Received:
    1

    This may just be a cache problem. If php works for one page it should work for the other.
     
Loading...