SuPHP On Fedora 7 Or CentOS 5 With ISPConfig

Version 1.0
Author: Oliver Meyer <o [dot] meyer [at] projektfarm [dot] de>

This document describes how to set up suPHP on Fedora 7 or CentOS 5 with ISPConfig. It rests upon parts of the howto How To Set Up suPHP On A Debian Etch Based ISPConfig Server from Hans.

The resulting system will support suPHP with ISPConfig.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

 This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Setup Basic System

Set up a basic system as fundament.

If you want to use Fedora 7, follow the Howto The Perfect Server - Fedora 7 from Falko Timme.
Else, if you want to use CentOS 5, follow the Howto The Perfect Setup - CentOS 5.0 (32-bit) from Falko Timme.

After that set up ISPConfig.

Download it from http://www.ispconfig.org. A detailed documentation is available there of course.

 

2 Disable The PHP Module

vi /etc/httpd/conf.d/php.conf

Comment out "LoadModule php5_module modules/libphp5.so"

 

3 Install PHP As Cgi

yum install php-cli

 

4 Get And Customize SuPHP

cd /tmp
wget http://www.suphp.org/download/suphp-0.6.2.tar.gz
tar xvfz suphp-0.6.2.tar.gz
vi suphp-0.6.2/src/apache2/mod_suphp.c

Replace the lines 324/325 with these two lines below (if you use a different version of suPHP, the line numbers can be different):

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"),


Now we prepare and install suphp:

cd suphp-0.6.2/
./configure --prefix=/usr --sysconfdir=/etc --with-apr=/usr/bin/apr-1-config --with-apxs=/usr/sbin/apxs --with-apache-user=apache --with-setid-mode=paranoid --with-php=/usr/bin/php-cgi --with-logfile=/var/log/httpd/suphp_log --enable-SUPHP_USE_USERGROUP=yes
make
make install

 

5 Suphp Configuration

vi /etc/suphp.conf

Should look like this:

[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=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/php-cgi
;Handler for CGI-scripts
x-suphp-cgi=execute:!self

 

6 Apache Configuration

vi /etc/httpd/conf.d/suphp.conf

Insert the following line:

LoadModule suphp_module modules/mod_suphp.so

 

7 ISPConfig Configuration

vi /home/admispconfig/ispconfig/lib/config.inc.php

Change:

$go_info["server"]["apache2_php"] = 'both';

To:

$go_info["server"]["apache2_php"] = 'suphp';

After that restart the Apache Webserver:

/etc/init.d/httpd restart

Now you have to modify a web in ISPConfig.
Ths will initiate ISPConfig to write a new vhost-file with suPHP-support.
After that ISPConfig should work fine with suphp.

 

Share this page:

1 Comment(s)