Some additional packages will be needed for the installation, so we will install them first :
# yum -y groupinstall “Development Tools”
# yum -y mysql-devel libtool-ltdl-devel bzip2-devel libcurl-devel libxml2-devel libmcrypt-devel curl-devel
Now download PHP package from www.php.net/downloads.php# cd /usr/local/src
# wget http://museum.php.net/php5/php-5.2.17.tar.bz2
# tar -xvzf php-5.2.17.tar.bz2
# cd php-5.2.17
Compile and install PHP
# make clean
# make
# make install
Now we need to make apache to detect this installation. As its Kloxo we need to perform some additional tasks/modifications. First create a script,
# cd /var/www/cgi-bin
# vi php52-cgi
Add the below code :
#!/bin/sh
PHPRC=”
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /usr/local/php_52/bin/php-cgi
Then save the file.# chmod +x php52-cgi
# cd ~
# ln -s /usr/local/php_52/bin/php-cgi /usr/local/bin/php52
Now we need to modify apache config
# cp -prf /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_org
# echo ‘Enable PHP5.2 Handlers’ >> /etc/httpd/conf/httpd.conf
# echo ‘ScriptAlias /php52-cgi /var/www/cgi-bin/php52-cgi’ >> /etc/httpd/conf/httpd.conf
# echo ‘Action application/x-httpd-php52 /php52-cgi’ >> /etc/httpd/conf/httpd.conf
But when we runs fixweb script, the additions to httpd.conf will get deleted. So, we need to modify fixweb script
# cp /script/fixweb /script/fixweb.orig
# vi fixweb
Add the below code :
#!/bin/sh
. /script/fix.inc
. /script/directory
lphp.exe ../bin/fix/fixweb.php $*
#Reinstate php5.2 handlers
echo ‘Enable PHP5.2 Handlers’ >> /etc/httpd/conf/httpd.conf# echo ‘ScriptAlias /php52-cgi /var/www/cgi-bin/php52-cgi’ >> /etc/httpd/conf/httpd.conf
# echo ‘Action application/x-httpd-php52 /php52-cgi’ >> /etc/httpd/conf/httpd.conf
service httpd restart
Then save the file.
# mv fixweb /script/fixweb
# chmod 700 /script/fixweb
Now add the following code in your website’s .htaccess file :
<FilesMatch “.php”>
SetHandler application/x-httpd-php52
</FilesMatch>
That’s all.. 🙂
COMMENTS