Learnt a neat trick to update/upgrade Php 4.4.7 on my test server to php 5.2.5 running centos 5 and direct admin as control panel. Took me a while to google up all the answers, so thought why not just put a small tutorial to install php 5.2.5 on apache2 based machine with direct admin on it.
First for sake of it run
yum install libxml-devel (this command on centos upgrades libxml or installs it if its mising and trust me you need to do this cause it saves time, otherwise php compile will end abruptly giving error :
Configuring extensions
checking whether to enable LIBXML support… yes
checking libxml2 install dir… no
checking for xml2-config path…
configure: error: xml2-config not found. Please check your libxml2 installation.
*** There was an error while trying to configure php. Check the configure.php file
Better safe than sorry
.
After that has taken place do like mentioned below and you should be all set.
Login to server as Root.
Type (do not copy entire commands here go in steps)
Note that if you have different version of php than 4.4.7 running,
change PHP_VER=4.4.7 that to your current version of PHP installed.
cd /usr/local/directadmin/customapache
rm -fr build
wget http://files.directadmin.com/services/customapache/build
chmod 755 build
./build update
./build clean
wget http://files.directadmin.com/services/customapache/php-5.2.5.tar.gz
perl -pi -e ‘s/PHP_VER=4.4.7/PHP_VER=5.2.5/’ build
./build php_ap2
Now wait for it to upgrade/install say yes to things it asks to reinstall it doesnt hurt.
Copy httpd.conf file for backup :
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.safe.copy
Now few things we should check before restarting apache.
Edit /etc/httpd/conf/httpd.conf using nano /etc/httpd/conf/httpd.conf as command.
Locate for following
LoadModule php4_module /usr/lib/apache/libphp4.so
if its there comment it out like this :
#LoadModule php4_module /usr/lib/apache/libphp4.so
Add this after that if this line does not exist :
LoadModule php5_module /usr/lib/apache/libphp5.so
Search for
application/x-httpd-php
To this add php5 like this if it does not exist already:
application/x-httpd-php .inc .php .php5 .php4 .php3 .phtml
Save file and exit, and rebooot httpd or apache2 using :
/sbin/service httpd restart
Enjoy. (will post tutorial on how to update apache 1.3 to apache 2 also on direct admin soon)
Tags: centos, direct admin, php, php upgrade, php5





