Tutorial on how-to compile php5 with imap support on a litespeed server

Step 1 : Install imap

Here are the required steps :

root@server []#cd /usr/src

root@server []#wget ftp://ftp.cac.washington.edu/imap/imap.tar.gz

root@server []#tar -xzvf imap.tar.gz

root@server []#cd imap-2007e

root@server []#make lfd

root@server []#mkdir /usr/local/imap

root@server []#cp -prf c-client/ /usr/local/imap

Step 2 : Recompile php with the options –with-imap=/usr/local/imap and –with-imap-ssl

Here are the steps for recompiling php on a litespeed server:

1) Download the source for php5 from http://www.php.net/downloads.php.

root@server [/opt]# wget http://us3.php.net/get/php-5.2.6.tar.gz/from/us2.php.net/mirror

root@server [/opt]# tar -zxf php-5.2.6.tar.gz

2) Change the directory to php-source/sapi directory.

root@server [/opt]# cd php-5.2.6/sapi

3) Download the latest LSAPI for PHP from http://www.litespeedtech.com.

root@server [/opt/php-5.2.6/sapi]wget http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.7.tgz

root@server [/opt/php-5.2.6/sapi]tar -zxf php-litespeed-4.7.tgz

4) Change the directory to root PHP source directory and run the following commands:

root@server [/opt/php-5.2.6]cd ..
root@server [/opt/php-5.2.6]touch ac*
root@server [/opt/php-5.2.6]./buildconf –force

5) Configure/Compile PHP

./configure –prefix=/opt/lsws/lsphp5 –enable-shmop –enable-sysvsem –enable-sysvshm –enable-magic-quotes –enable-mbstring –with-iconv –exec-prefix=/usr –bindir=/usr/bin –sbindir=/usr/sbin –with-config-file-path=/usr/lib/php –with-litespeed –with-xml –with-curl=/usr –enable-ftp –with-gd –with-jpeg-dir=/usr/ –with-png-dir=/usr –with-xpm-dir=/usr/X11R6 –enable-memory-limit –with-mysqli –with-mysql=/usr –with-openssl –enable-discard-path –enable-sockets –enable-track-vars –with-ttf –with-freetype-dir=/usr –enable-gd-native-ttf –disable-json –disable-pdo –without-iconv –without-sqlite –with-zlib –enable-pcntl –enable-memcache –with-imap=/usr/local/imap –with-imap-ssl

Step 3 : Take a backup of the existing lsphp5 binary located in the /opt/lsws/fcgi-bin/ directory

root@server [/opt/lsws/fcgi-bin]# ll
-r-xr-xr-x 1 root root 2031800 Sep 3 2008 lsphp*
lrwxrwxrwx 1 root root 7 Sep 3 2008 lsphp4 -> ./lsphp*
lrwxrwxrwx 1 root nobody 13 Sep 7 2008 lsphp5 -> ./lsphp-5.2.6*
-rwxr-xr-x 1 root nobody 15762131 Sep 6 2008 lsphp-5.2.6*
root@server [/opt/lsws/fcgi-bin]#mv lsphp-5.2.5 lsphp-5.2.5.bkp

Step 4 : Copy the the php binary from /opt//opt/php-5.2.6/sapi/litespeed/php to /opt/lsws/fcgi-bin/

root@server[/opt/lsws/fcgi-bin]#cp -p /opt/php-5.2.6/sapi/litespeed/php /opt/lsws/fcgi-bin

Step 5 : Rename the php binary to lsphp-5.2.6

root@server [/opt/lsws/fcgi-bin]#mv php lsphp-5.2.6

Step 6 : Change the ownership and restart Apache.

root@server [/opt/lsws/fcgi-bin]# chown root.nobody lsphp-5.2.6

root@server [/opt/lsws/fcgi-bin]#/scripts/restartsrv_httpd

Thats it! You should be all set now.

Contact Us On WhatsApp