• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

mod_suphp

19patje72

New Pleskian
hi,

I have seen various threads and links to get mod_suphp working. But I cant get it done. I need it only for one subdomain only.

The Plesk version is 9.5.2 and Ive got this rpm package installed: mod_suphp-0.6.3-1.fc8

These are the config files.
cat /etc/httpd/conf.d/mod_suphp.conf
LoadModule suphp_module modules/mod_suphp.so


cat /etc/suphp.conf
[global]
logfile=/var/log/suphp.log

loglevel=warn

webserver_user=apache

docroot=/var/www/vhosts:${ HOME}/httpdocs

allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

check_vhost_docroot=true

errors_to_browser=true

env_path=/bin:/usr/bin

umask=0022

min_uid=500

min_gid=500

handle_userdir=true

[handlers]
php5-script=php:/usr/bin/php-cgi

x-suphp-cgi=execute:!self


cat httpd.include, this is only the subdomain part. The domain part is untouched.
<VirtualHost x.x.x.x:80>
ServerName www2.domain.com:80
ServerAdmin "[email protected]"
DocumentRoot /var/www/vhosts/domain.com/subdomains/www2/httpdocs
CustomLog /var/www/vhosts/domain.com/statistics/logs/access_log plesklog
ErrorLog /var/www/vhosts/domain.com/statistics/logs/error_log
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
<Directory /var/www/vhosts/domain.com/subdomains/www2/httpdocs>
<IfModule mod_suphp.c>
php_admin_flag engine off
suPHP_Engine on
AddHandler x-httpd-php .php .php5
#suPHP_UserGroup apache apache
suPHP_AddHandler x-httpd-php
suPHP_ConfigPath "/var/www/vhosts/domain.com/subdomains/www2/etc"
</IfModule>
Options -Includes -ExecCGI
</Directory>
Alias "/error_docs" "/var/www/vhosts/domain.com/error_docs"
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 401 /error_docs/unauthorized.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html
ErrorDocument 405 /error_docs/method_not_allowed.html
ErrorDocument 406 /error_docs/not_acceptable.html
ErrorDocument 407 /error_docs/proxy_authentication_required.html
ErrorDocument 412 /error_docs/precondition_failed.html
ErrorDocument 415 /error_docs/unsupported_media_type.html
ErrorDocument 501 /error_docs/not_implemented.html
ErrorDocument 502 /error_docs/bad_gateway.html
</VirtualHost>


anyone got an idea what I'm missing here?

thanks, Patrick
 
suPHP Configuration Woes

HELP! I've gone through the guide at http://www.grafxsoftware.com/faq.php/HOW-TO-Setup-a-PLESK-Dedicated-Server/1/4/ for HOURS on end and still can't seem to get this right.

I'm getting an error starting apache…

Starting httpd: [Sun Sep 19 20:48:50 2010] [warn] module ssl_module is already loaded, skipping
Syntax error on line 11 of /var/www/vhosts/domain.com/conf/vhost.conf:
suPHP_PHPPath not allowed here
[FAILED]

I'm running:
Plesk 9.5
Centos 5.5
Apache 2.2
suPHP 0.7.1

Here's my /etc/httpd.conf/suphp.conf

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

# Disable php when suphp is used, to avoid having both.
# <IfModule mod_php5.c>
# php_admin_flag engine off
# </IfModule>
# <IfModule mod_php4.c>
# php_admin_flag engine off
# </IfModule>

# To use suPHP to parse PHP-Files
# AddHandler x-httpd-php .php
# AddHandler x-httpd-php .php .php4 .php3 .phtml

# This option tells mod_suphp which path to pass on to the PHP-interpreter
# (by setting the PHPRC environment variable).
# Do *NOT* refer to a file but to the directory the file resides in.
#
# E.g.: If you want to use "/path/to/server/config/php.ini", use "suPHP_Config
# /path/to/server/config".
#
# If you don't use this option, PHP will use its compiled in default path.
# suPHP_ConfigPath /etc

# If you compiled suphp with setid-mode "force" or "paranoid", you can
# specify the user- and groupname to run PHP-scripts with.
# Example: suPHP_UserGroup foouser bargroup
# suPHP_UserGroup apache apache

# This option tells mod_suphp to handle requests with the type <mime-type>.
# Please note this only works, if an action for the handler is specified
# in the suPHP configuration file.
# suPHP_AddHandler x-httpd-php

# This option tells mod_suphp to NOT handle requests with the type <mime-type>.
# suPHP_RemoveHandler <mime-type>

Here's /etc/suphp.conf

[global]
logfile=/var/log/httpd/suphp_log
loglevel=info
webserver_user=apache
docroot=/var/www/vhosts:${HOME}/httpdocs
env_path=/bin:/usr/bin
umask=0022
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=true

[handlers]
;Handler for php-scripts
php5-script="php:/usr/bin/php-cgi"

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

And finally /var/www/vhosts/domain.com/conf/vhost.conf

<IfModule mod_suphp.c>
<Directory "/var/www/vhosts/domain.com/httpdocs/">
php_admin_flag engine on
suPHP_Engine On
suPHP_ConfigPath "/var/www/vhosts/domain.com/httpdocs/"
AddHandler x-httpd-php .php
AddHandler php5-script .php
AddHandler x-httpd-php .php .php5 .php4 .php3 .phtml
suPHP_AddHandler x-httpd-php
suPHP_AddHandler php5-script .php
suPHP_PHPPath
php_value open_basedir "/tmp/"
php_value upload_tmp_dir "/var/www/vhosts/domain.com/tmp/"
<Files php.ini>
order allow,deny
deny from all
php_value open_basedir "/tmp/"
php_value upload_tmp_dir "/var/www/vhosts/domain.com/httpdocs/tmp/"
</Files>
</Directory>
</IfModule>
 
Try to change this to
docroot=/var/www/vhosts:${HOME}/httpdocs

docroot=/var/www/
 
Here is what I am doing when installing suphp on Plesk ( I am working for a webhosting company ... every time it worked without problems). This can be adapted for custom php installations (running both php4 and php5 or just one of them in a different location).

wget http://www.suphp.org/download/suphp-0.7.1.tar.gz
tar -zxf suphp-0.7.1.tar.gz
cd suphp-0.7.1
./configure --prefix=/opt/suphp --with-apxs=/usr/sbin/apxs --with-setid-mode=force --with-apache-user=apache --with-log=/var/log/suphp.log
make
make install

Test if suphp binary has been generated and is working properly:

/opt/suphp/sbin/suphp

suPHP version 0.7.1
(c) 2002-2007 Sebastian Marsching
suPHP has to be called by mod_suphp to work.

Check if mod_suphp.so apache module has been correctly put in /usr/lib/httpd/modules/:

ls -l /usr/lib/httpd/modules/mod_suphp.so
-rwxr-xr-x 1 root root 47972 Jan 29 07:10 /usr/lib/httpd/modules/mod_suphp.so

Create a /etc/httpd/conf.d/suphp.conf file:

LoadModule suphp_module modules/mod_suphp.so
suPHP_Engine off

Create a /opt/suphp/etc/suphp.conf file:

[global]
loglevel=info
webserver_user=apache

allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

check_vhost_docroot=true

errors_to_browser=false

[handlers]
x-httpd-php="php:/usr/bin/php-cgi"
x-httpd-php5="php:/usr/bin/php-cgi"

Disable PHP from Plesk for the user(s) needing suPHP. (if you have custom installation of php )

Go to /var/www/vhosts/domain.com/conf and create a vhost.conf file if it does not exist already:

suPHP_Engine on
<IfModule mod_php5.c>
php_admin_flag engine off
</IfModule>
<IfModule mod_php4.c>
php_admin_flag engine off
</IfModule>
AddHandler x-httpd-php .php
AddHandler x-httpd-php5 .php5
suPHP_UserGroup USER psacln
suPHP_AddHandler x-httpd-php
suPHP_AddHandler x-httpd-php5

Make sure you change the suPHP_UserGroup or it will not work!!


/usr/local/psa/admin/bin/websrvmng -a
service httpd restart

To test the installation create a file test.php (make sure safe_mode is disabled and the file has no more then 644 permissions and the folder 755) :

<?php

echo "This PHP file is runnig as: ".`id`."<br /> <br />";
phpinfo ();

?>
 
Last edited:
ART repository contain the mod_suphp package, easy, just yum install mod_suphp :) and then to do the small modifications. Can be done in 2 min.
 
Back
Top