Add to Favourites Add to Favourites    Print this Article Print this Article

How to update to php 5

Note: If you want the latest version of php and apache, it's recommended you use custombuild:
http://files.directadmin.com/services/custombuild/1.1

The following guide is only to be used if if you still want to use the old apache versions... basically, only if you still need FrontPage.

FrontPage is discontinued. Do not use it



To update to php5, the build script will still work. All that you need to do is swap out the version, compile normally and make a few modifications to your /etc/httpd/conf/httpd.conf file.

1) download the php-5.2.4.tar.gz from php.net into your customapache directory:

cd /usr/local/directadmin/customapache
wget http://files.directadmin.com/services/customapache/php-5.2.4.tar.gz


2) change your build script for the new version:

nano build

change: PHP_VER=4.4.4
to: PHP_VER=5.2.4

3) build php normally:

./build clean
./build php n

If you're using apache 2.x, use

./build clean
./build php_ap2 n

instead.

4) edit /etc/httpd/conf/httpd.conf
Remove any referce of:

LoadModule php4_module        modules/libphp4.so


and make sure they're replaced with:

LoadModule php5_module        modules/libphp5.so


Remove any reference of:

AddModule mod_php4.c

and replace with:

AddModule mod_php5.c



5) find this piece of code:

   DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.phtml index.cgi

replace with:

   DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php5 index.php3 index.phtml index.cgi

Find this:

       AddType application/x-httpd-php .inc .php .php4 .php3 .phtml
       AddType application/x-httpd-php-source .phps
   (it might have AddHandler instead of AddType)
replace with:

mod_php5.c>
       AddHandler application/x-httpd-php .inc .php .php5 .php4 .php3 .phtml
       AddHandler application/x-httpd-php-source .phps
   Then restart apache.

If you get the following error while compiling php:

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

Then edit the configure.php file (or configure.php_ap2 if you're using apache 2), and change:

--with-xml \

to:

       --disable-libxml \
       --disable-dom \
       --disable-xml \
       --disable-simplexml \
       --disable-xmlreader \
       --disable-xmlwriter \

or else install the missing rpms/packages for xml. (libxml2-dev and libxml2-utils on debian).   Redhats:

yum -y install libxml2-devel libxslt-devel

FreeBSD:

pkg_add -r libxml2
pkg_add -r libxslt

On debian systems if using apt-get to install libxml2-dev and libxml2-utils doesn't work, then install from source:

wget http://files.directadmin.com/services/customapache/libxml2-2.6.30.tar.gz
tar xvzf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure
make && make install

then recompile php as usual.

Was this answer helpful?

Also Read