PHP 5.2 is deprecated a long time ago, but still, we had to fire up an old website on a CentOS 7 box using LiteSpeed. Although building PHP 5.2 from source should be supported, it doesn’t really work “out of the box” and some workarounds are needed.
Before we start, let’s start by installing missing packages (Others may be needed, depending on your server)
yum install autoconf213 libjpeg* libpng* mysql-devel
Start compile process:
Go to Litespeed admin -> actions -> compile php -> php 5.2 -> next
Paste this into configure parameters:
'--with-mysqli' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-mbstring' '--with-iconv' '--with-mysql' '--with-mcrypt' '--with-pdo' '--with-pdo-mysql' '--enable-ftp' '--enable-zip' '--with-curl' '--enable-soap' '--enable-calendar' '--enable-xml' '--enable-json' '--with-openssl' '--enable-bcmath' '--with-litespeed' '--with-libdir=/lib64
Click on “Build PHP 5.2”
Now to the tricky part! Before continuing the compile process, we need to apply a patch I found in github (with the courtesy of Konstantin Kelemen), From your server’s CLI, do the following –
Download the patch and apply it –
cd /usr/local/lsws/phpbuild/ wget https://gist.githubusercontent.com/konstantin-kelemen/f8b93428d2c4f57c590168da0a72d8fd/raw/8754ad5420e848bbeac1134bfdeabcdc1cfa2615/php-5.2.17.patch -O fixphp.patch patch -p0 < fixphp.patch
Fix the autoconf (where XXXXXX are numbered for the correct script file)
vi buildphp_XXXXXXXX.x.install.sh
Paste this on line 2 (right after #!/bin/sh):
export PHP_AUTOCONF=/usr/bin/autoconf-2.13 export PHP_AUTOHEADER=/usr/bin/autoheader-2.13
Run build script –
/usr/local/lsws/phpbuild/buildphp_manual_run.sh
Go back to the Litespeed admin window and monitor the output.
If it fails for example for missing packages (or any other fixable reason), you can fix what’s needed/missing and execute the build script again.
Leave a Reply