A partire dalla versione 2.2.20, ISPConfig ha migliorato il supporto persuPHP. Questo articolo spiega come installare suPHP su varie distribuzioni supportate da ISPConfig. (Se avete usato suPHP con le versioni precedenti di ISPConfig, l’installazione funzionerà comunque.)
Io non rilasciano alcuna garanzia che questo funziona per voi!
1 debian Etch / Ubuntu 7.10
Per Debian e Ubuntu, esiste il pacchetto libapache2-mod-suphp , tuttavia il problema con questo pacchetto è che non supporta la direttiva suPHP_UserGroup(che è utilizzata da ISPConfig) poiché non è stato compilato utilizzando il … con setid-modalità = paranoico passare. Pertanto dobbiamo costruire mod_suphp manualmente.
Innanzitutto disattivare il modulo PHP5 normale (come root):
a2dismod php5
/etc/init.d/apache2 restart
Quindi installiamo i prerequisiti necessari per costruire mod_suphp:
apt-get install php5-cgi apache2-prefork-dev
Ora possiamo scaricare e costruire suPHP come segue:
CD/tmp
wget http://www.suphp.org/download/suphp-0.6.2.tar.gz
tar xvfz suphp-0.6.2.tar.gz
suphp CD-0.6.2
. / configure– prefix = / usr – sysconfdir = / ecc-with-apache-user = www-data–con-setid-modalità = paranoico – con-apxs = / usr/bin/apxs2
fare
fare installare
Infine aggiungiamo il modulo suPHP alla nostra configurazione di Apache…
vi /etc/apache2/httpd.conf
|
… e riavviare Apache:
/etc/init.d/apache2 restart
2 fedora 8 / CentOS 5.1
8 di Fedora e CentOS 5.1, dobbiamo costruire mod_suphp manualmente per gli stessi motivi come per Debian e Ubuntu (suPHP_UserGroup).
Innanzitutto disattivare il modulo PHP5 normale:
vi /etc/httpd/conf.d/php.conf
Commento la riga LoadModule :
[...] #LoadModule php5_module modules/libphp5.so [...] |
Quindi installiamo i prerequisiti necessari per costruire mod_suphp:
yum install php-cli httpd-devel
Ora possiamo scaricare e costruire suPHP come segue:
CD/tmp
wget http://www.suphp.org/download/suphp-0.6.2.tar.gz
tar xvfz suphp-0.6.2.tar.gz
CD suphp-0.6.2/
. / /configure–prefix = / usr – sysconfdir = / ecc-con-apr = / usr/bin/apr-1-config–con-apxs = / usr/sbin/apxs-with-apache-user = apache – con-setid-modalità = paranoico..–con php = / usr/bin/php-cgi – con-logfile = / var/log/httpd/suphp_log… Enable-SUPHP_USE_USERGROUP = yes
make
make install
Finally we add the suPHP module to our Apache configuration…
vi /etc/httpd/conf.d/suphp.conf
|
… and restart Apache:
/etc/init.d/httpd restart
3 Mandriva 2008.0
On Mandriva 2008.0, we must build mod_suphp manually for the same reasons as for Debian and Ubuntu (suPHP_UserGroup).
First we disable the normal PHP5 module:
vi /etc/httpd/modules.d/70_mod_php.conf
Comment out the LoadModule line:
<IfDefine HAVE_PHP5> <IfModule !mod_php5.c> #LoadModule php5_module extramodules/mod_php5.so </IfModule> </IfDefine> [...] |
Then we install the prerequisites needed to build mod_suphp:
urpmi php-cgi apache-devel
Now we can download and build suPHP as follows:
cd /tmp
wget http://www.suphp.org/download/suphp-0.6.2.tar.gz
tar xvfz suphp-0.6.2.tar.gz
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
Finally we add the suPHP module to our Apache configuration…
vi /etc/httpd/modules.d/A36_mod_suphp.conf
|
… and restart Apache:
/etc/init.d/httpd restart
4 OpenSUSE 10.3
OpenSUSE 10.3 comes with a suPHP package that understands the suPHP_UserGroup directive, so we don’t have to build it ourselves.
First we disable the normal PHP5 module. Open /etc/sysconfig/apache2 and remove php5 from the APACHE_MODULES line (so that it looks similar to this line – your modules might differ, but php5 must not be listed anymore):
vi /etc/sysconfig/apache2
[...] APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir rewrite ruby" [...] |
Run
SuSEconfig
afterwards.
Now we install suPHP as follows:
yast -i suphp
Next we add suphp to the APACHE_MODULES line in /etc/sysconfig/apache2, e.g. like this:
vi /etc/sysconfig/apache2
[...] APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir rewrite ruby suphp" [...] |
OpenSUSE’s suPHP packages comes with a suPHP configuration that enables suPHP globally. Therefore we must disable this configuration now so that we can enable or disable suPHP in ISPConfig on a per-website basis:
vi /etc/apache2/conf.d/mod_suphp.conf
In that file we comment out everything:
#<IfModule mod_suphp.c> # suPHP_Engine on # # AddType application/x-httpd-php .php # AddType application/x-httpd-php .php3 # AddType application/x-httpd-php .php4 # AddType application/x-httpd-php .php5 # AddHandler application/x-httpd-php .php # # DirectoryIndex index.php index.php3 index.php4 index.php5 # # <Location /> # suPHP_AddHandler application/x-httpd-php # </Location> #</IfModule> # in your vhost you need: #<Virtualhost *> # suPHP_UserGroup someuser somegroup #</Virtualhost> |
Finally we run:
SuSEconfig
/etc/init.d/apache2 restart
5 Configure ISPConfig
Finally we must tell ISPConfig that it should write a suPHP configuration to the Apache vhosts instead of the usual PHP configuration. To do this, we open ISPConfig’s configuration file /home/admispconfig/ispconfig/lib/config.inc.php and set $go_info[“server”][“apache2_php”] to suphp:
vi /home/admispconfig/ispconfig/lib/config.inc.php
[...] $go_info["server"]["apache2_php"] = 'suphp'; [...] |
Ora ogni volta che si attiva PHP per un sito web in ISPConfig, ISPConfig scriverà una configurazione suPHP configurazione vhost di quel sito web.
6 collegamenti
- suPHP: http://www.suphp.org
- ISPConfig: http://www.ispconfig.org