Onderstaand zijn de stappen die ik neem om suphp, php4, php5 op een centos machine icm directadmin te installeren. Dit naar voorbeeld van een thread op het directadmin forum. Ik ben zelf een tijd aan het stoeien geweest omdat ik de geplaatste oplossingen van bepaalde problemen nou niet echt de oplossing vond.
Uitpakken van de zojuist gedownloade files.,Code:[root@test]#cd /usr/local/src/ [root@test]#wget http://de.php.net/get/php-5.1.5.tar.gz/from/this/mirror [root@test]#wget http://de.php.net/get/php-4.4.4.tar.gz/from/this/mirror [root@test]#wget http://downloads.mijn-sleutel.net/DA/suphp-0.6.1.tar.gz
# CONFIGURE & COMPILEN PHP4Code:[root@test]#tar -zxvf php-5.1.5.tar.gz [root@test]#tar -zxvf php-4.4.2.tar.gz [root@test]#tar -zxvf suphp-0.6.1.tar.gz
# CONFIGURE & COMPILEN PHP5Code:[root@test]#cd php-4.4.2 [root@test]#./configure --prefix=/usr/local/php4 --enable-force-cgi-redirect --enable-fastcgi --with-config-file-path=/usr/local/etc/php4/cgi --with-curl --with-curl-dir=/usr/local/lib --with-gd --with-gd-dir=/usr/local/lib --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-mcrypt --with-mhash --with-mysql=/usr --with-pear --with-png-dir=/usr/local/lib --with-xml --with-zlib --with-zlib-dir=/usr/local/lib --with-zip --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --enable-track-vars --enable-mbstring --enable-memory-limit [root@test]#make [root@test]#make install
# CONFIGURE & COMPILEN suPHPCode:[root@test]#cd ../php-5.1.5 [root@test]#./configure --prefix=/usr/local/php5 --enable-force-cgi-redirect --enable-fastcgi --with-config-file-path=/usr/local/etc/php5/cgi --with-curl --with-curl-dir=/usr/local/lib --with-gd --with-gd-dir=/usr/local/lib --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-mcrypt --with-mhash --with-mysql=/usr --with-pear --with-png-dir=/usr/local/lib --with-xml --with-zlib --with-zlib-dir=/usr/local/lib --with-zip --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --enable-track-vars --enable-mbstring --enable-memory-limit [root@test]#make [root@test]#make install
# Maken van de juiste directoriesCode:[root@test]#cd ../suphp-0.6.1 [root@test]#./configure --prefix=/usr/local/suphp --sysconfdir=/usr/local/suphp/etc/ --with-apache-user=apache --with-setid-mode=force --with-apxs=/usr/sbin/apxs --disable-checkpath [root@test]#make [root@test]#make install
# COPIEREN PHP CONFIG FILESCode:[root@test]#mkdir -p /usr/local/etc/php4/cgi [root@test]#mkdir -p /usr/local/etc/php5/cgi [root@test]#mkdir -p /usr/local/suphp/etc
Let op, ik copieer hier hele nieuwe ini files in, je moet deze aanpassen naar wens. Je kan evt de oude php.ini van de huidige php install erheen copieren. In de folder stdvrthost staat de php.ini voor de virtualhost waar ook webmail, phpmyadmin op draaien.Code:[root@test]#cp /usr/local/src/php-5.1.5/php.ini-dist /usr/local/etc/php5/cgi/php.ini [root@test]#mkdir /usr/local/etc/php4/cgi/stdvrthost [root@test]#cp /usr/local/src/php-4.4.2/php.ini-dist /usr/local/etc/php4/cgi/php.ini [root@test]#cp /usr/local/src/php-4.4.2/php.ini-dist /usr/local/etc/php4/cgi/stdvrthos/php.ini [root@test]#cp /usr/local/src/suphp-0.6.1/doc/suphp.conf-example /usr/local/suphp/etc/suphp.conf
# Maak van de originele files
# Maak logfile voor suphpCode:[root@test]#cp /usr/local/suphp/etc/suphp.conf suphp.conf.original [root@test]#cp /etc/httpd/conf/httpd.conf httpd.conf.original
Voeg deze zelf toe aan bijvoorbeeld logrotate.Code:touch /var/log/suphp.log
# Aanpassen van de suPHP configuratie
Code:[root@test]#vi /usr/local/suphp/etc/suphp.conf neem onderstaande gegevens over: ;User Apache is running as webserver_user=apache ;Path all scripts have to be in docroot=/ ;Check wheter script is within DOCUMENT_ROOT check_vhost_docroot=false ;Umask to set, specify in octal notation umask=0022 ; Minimum UID min_uid=100 ; Minimum GID min_gid=500 [handlers] ;Handler for php-scripts x-httpd-php=php:/usr/local/php4/bin/php x-httpd-php5=php:/usr/local/php5/bin/php
# Aanpassen van de HTTPD.CONF
# Directadmin templates aanpassen:Code:[root@test]#nano /etc/httpd/conf/httpd.conf Na : LoadModule php4_module /usr/lib/apache/libphp4.so LoadModule frontpage_module /usr/lib/apache/mod_frontpage.so LoadModule perl_module /usr/lib/apache/mod_perl.so Voegtoe : LoadModule suphp_module /usr/lib/apache/mod_suphp.so na AddHandler cgi-script .cgi .pl Voegtoe: AddHandler x-httpd-php .php .inc .php4 AddHandler x-httpd-php5 .php5 suPHP_AddHandler x-httpd-php suPHP_AddHandler x-httpd-php5 in <VirtualHost IP:80> Voegtoe: suPHP_Engine ON suPHP_AddHandler x-httpd-php suPHP_ConfigPath (/usr/local/etc/php4/cgi/stdvrthost) suPHP_UserGroup apache apache save httpd.conf [root@test]#chown -R apache:apache /var/www/html/*
Als het goed is zal httpd herstarten en gewoon naar behoren werken. Altans dat is bij mij wel het geval. De php files worden als php4 behandeld, php5 files worden als php5 behandel. Wil je nou dat alle php bestanden als php5 behandeld worden dan kun je dit oplossen door in het .htaccess het volgende te zetten: AddHandler x-httpd-php5 .phpCode:[root@test]#cd /usr/local/directadmin/data/templates [root@test]#cp virtual_host2* custom [root@test]#cd custom pas de 4 files aan. Na |CGI| Voegtoe: Redirect 301 /webmail http://|IP|/webmail Na |USECANONICALNAME| Voegtoe: suPHP_Engine |PHP| suPHP_UserGroup |USER| |GROUP| <Files *.php> SetEnv PHPRC /usr/local/directadmin/data/users/|USER|/php4/ </Files> <Files *.php5> SetEnv PHPRC /usr/local/directadmin/data/users/|USER|/php5/ </Files> doe dit bij alle 4 de bestanden, daarna rebuild all conf files. [root@test]#echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue [root@test]#service httpd restart
Om php uit te zetten edit de httpd.conf van betreffend domein:
suPHP_Engine off
RemoveHandler .php
RemoveHandler .php5
Je kan na deze setup een ideale php.ini maken, heb je echter een gebruiker die toch wat aanpassingen nodig heeft, dan kun je per gebruiker een php.ini file gebruiken. Deze worden realtime gelezen. Om een gebruiker een eigen php.ini te geven maak je in de volgende directory twee directories aan, namelijk php4 en php5. Beide gebruiken hun eigen php.ini file(s).
/usr/local/directadmin/data/users/|USER|/ . Maak de directories aan en copier daarin de gewenste php.ini.
Mocht ik ergens gigantisch de plank misschieten, dan hoor ik dat uiteraard graag![]()

Likes:


Quote