PHP Compilation for Litespeed Webserver

Litespeed web server doesn’t come with all PHP modules, we need to compile PHP from source to add any new (or) third-party modules to PHP.

When the Litespeed installation is done, we can compile php and add the new php as a module.

1. Download the desired php version we need from Here we are picking latest stable 5.3.20 version.

tar -zxf php-5.3.20.tar.gz

2. Change the directory to sapi

cd php-5.3.20/sapi

3. We need to download latest litespeed module for php. (PHP 5.3.x comes with litespeed 4.x module but we are picking latest module from here )

rm -rf litespeed
tar -zxf php-litespeed-6.1.tgz

4. Change to PHP source directory

cd ../
touch ac*
./buildconf --force

5. Now we can compile PHP

./configure --prefix=/usr/local/lsphp5 --with-litespeed --with-libdir=lib64 --with-zlib --with-gettext --with-png --with-png-dir=/usr/lib64 --with-jpeg --with-jpeg-dir=/usr/lib64 --with-mysqli --with-iconv --with-mysql=/usr/lib64/mysql --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mcrypt=/usr/lib64 --with-openssl --enable-zip --with-gd --enable-shmop --enable-sockets --enable-sysvsem --enable-sysvshm --enable-bcmath --enable-exif --disable-magic-quotes --enable-mbstring --with-curl --enable-soap --enable-ftp --enable-calendar --with-tidy --with-ttf --with-xmlrpc --with-xsl --with-zlib --with-mhash
make install

We will get a lot of dependency error, we can install all the packages through “yum install package-name”

6. Now we need to copy the compiled PHP module to litespeed installation

cd /usr/local/lsws/fcgi-bin/
cp ~/php-5.3.20/sapi/litespeed/php lsphp-5.2.6
ln -sf lsphp-5.2.6 lsphp5

7. Check installation

cd ..
fcgi-bin/lsphp5 -v

PHP 5.3.20 (litespeed) (built: Jan 11 2013 16:50:20)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with the ionCube PHP Loader v4.0.12, Copyright (c) 2002-2011, by ionCube Ltd.

8. Create initial php configuration file (php.ini)

cp /usr/local/lsws/php/php.ini /usr/local/lsphp5/lib/php.ini

9. Restart litespeed server.

/etc/init.d/lsws restart

10. All done, now we can go ahead with Virtual configuration from admin web-console.

Leave a Reply

Your email address will not be published. Required fields are marked *