I know I know, nobody really wants to run PHP5 on their Media Temple Dedicated Server when PHP4 works just fine – well actually yes we did as one of our team is becoming a dab hand at writing PHP5 dependant classes and then having to find servers to run them.
Media Temple provide their own link on how to upgrade the system (http://kb.mediatemple.net/article.php?id=260) however this was having none of it for us so here’s a quick heads-up on how to do it our way.
1. Install YUM
There’s a few great articles on how to do this on the web (Google for CentOS and YUM) but the trick is to remember when you have it installed is that the packages missing from the central CentOS distribution can still be accessed with YUM you just need to use CentOSPlus.
yum --enablerepo=centosplus install <your package name>
2. Roll your own PHP 5
Download the latest PHP tar ball, unpack and start configuring. Here’s our config file which will help you build in all the dependencies that Media Temple has (zend, mysql, zlib etc.) – you will need to use YUM to get various packages and libraries, and some have to be located on the source websites, but here’s a hints to help.
– installing mcrypt
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz rpmbuild -ta libmcrypt-2.5.7.tar.gz rpm -ivh /usr/src/redhat/RPMS/i386/libmcrypt-2.5.7-1.i386.rpm /usr/src/redhat/RPMS/i386/libmcrypt-devel-2.5.7-1.i386.rpm yum --enablerepo=centosplus install php-mcrypt
– installing mhash
wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.tar.bz2?modtime=1175740797&big_mirror=0 bunzip2 mhash-0.9.9.tar.bz2 tar xvf mhash-0.9.9.tar cd mhash-0.9.9 ./configure make install
– configuring php5
./configure --with-apxs2=/usr/sbin/apxs --with-pear=/usr/share/pear --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i686-redhat-linux-gnu --prefix=$PHP_PREFIX --sysconfdir=/etc --localstatedir=/var --disable-debug --disable-rpath --disable-ipv6 --disable-dba --without-odbc --without-unixODBC --without-gdbm --enable-inline-optimization --enable-exif --enable-ftp --enable-sockets --enable-yp --enable-wddx --enable-memory-limit --enable-calendar --enable-mbstring --enable-soap --enable-bcmath --enable-gd-native-ttf --enable-zip --with-readline --with-libdir=lib --with-config-file-path=/etc --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr --with-expat-dir=/usr --with-libxml-dir=/usr --with-mysql=/usr/local/mysql --with-mysql-sock=/var/lib/mysql --with-mysqli --with-curl --with-gettext --with-iconv --with-openssl --with-mcrypt --with-mhash --with-gd --with-png --with-bz2 --with-zlib --with-layout=GNU --with-xml --with-xmlrpc --with-tidy
Restart your PSA system (
/usr/local/psa/admin/sbin/websrvmng -a -v
) and you should be cooking on a lovely PHP 5 install with everything else still as it was.