In web server management we often need PHP recompilation for Litespeed web server. LSAPI is LiteSpeed’s open-source API between external applications and LiteSpeed Web Server.This how-to is for compiling and installing PHP + LSAPI on Linux, OS X, FreeBSD, Solaris, and so on. LiteSpeed comes with PHP 4.4.x compiled with LSAPI. To change the LightSpeed php to the latest stable one, we need to recompile the php with the LSAPI for LiteSpeed.
I am trying to provide some info for doing this task.
Instructions:
a) Download the required php from php.net
wget http://in2.php.net/get/php-5.2.11.tar.bz2/from/this/mirror
tar -xzvf php-5.2.11.tar.bz2
cd php-5.2.11/sapi
b) Download and the latest LSAPI for PHP from http://www.litespeedtech.com/ into the “sapi” folder of php source:
wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.10.tgz
tar -xvf php-litespeed-4.10.tgz
c) Change directory to root PHP source directory and run commands:
cd ..
touch ac*
./buldconf –force
d) Configure/Compiling
If you have an apache compilation already , remove the part option “–with-apxs” and use ” –with-litespeed” . Also you may need to change the “prefix” option too . So a basic configure command would be like this
./configure ‘–prefix=/lsphp5’ ‘–with-litespeed’ ‘with-mysql’
make
make install
Note: You must compile PCRE support inorder for the default auto-index php script to work correctly
Post Install Configurations
1. Replace the existing lsphp binary with the new one.
Change the directory to the current installation of “lsws” ( it varies on different machines)
cd /usr/local/lsws/fcgi-bin
mv lsphp lsphp.old
cp /php-5.2.11/sapi/litespeed/php lsphp-5.2.11
ln -sf lsphp5 lsphp-5.2.11
Check Installation
/usr/local/lsws/fcgi-bin/lsphp5 -v
It should return something like:
PHP 5.2.11 (litespeed) (built: Sep26 2008 14:09:09) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Notice litespeed in parenthesis. This means that the PHP binary has litespeed (LSAPI) support builtin.
2. php.ini
The php.ini file will be located at /usr/local/lsws/php/php.ini
If we want to use the old PHP.ini just copy it here.
# cd /usr/local/lsws/php # mv php.ini php.ini.old # cp /usr/local/ZEND/etc/php.ini .
3. Restart Litespeed Webserver
Finally restart LSWS and use our new PHP binary.
/usr/local/lsws/bin/lswsctrl restart
For further assistance you can contact our web server management team with your requirements