Install Lighttpd PHP and XCache from Source on Linux

This is a short description on how to install a robust LAMP web service environment. Here we will not choose Apache, but Lighttpd instead.

Firstly, let’s make two directories, one for source code compiling, and the other one is the installation path.

# mkdir ~/lighttpd  /home/lighttpd

and then, let’s start downloading all the related files:

# wget
# wget
# wget

Compile lighttpd from source code:

#  tar zxvf lighttpd-1.4.19.tar.gz
#  cd lighttpd-1.4.19
# ./configure --target=i386-redhat-linux \
--prefix=/home/lighttpd \
--with-openssl --with-pcre --with-zlib --with-bzip2 \
--disable-ipv6 --with-PACKAGE=mod_redirect \
--with-rewrite --with-redirect --with-ssi
# make && make install

It may also ask for some development packages, like bzip2-devel,
pcre-deve, you can also get a copy of these common packages from or rpm.pbone, please pay some attention to its version numbers.

# cp lighttpd-1.4.19/doc/rc.lighttpd.redhat bin/rc.lighttpd

This control file needs to be adjusted, you need to fix some path variables as we current no follow the standard way.

When finished creating lighttpd, it’s time to compile PHP.

#  tar jxvf php-5.2.6.tar.bz2
#  cd php-5.2.6
# ./configure --prefix=/home/lighttpd --with-mysql --with-gd \
--with-curl  --enable-zip  --enable-fastcgi --with-zlib --enable-zend-multibyte

You need to fix some depency errors, like curl-devel, it’s always
needed if you chose libcurl.After the installation, you need to copy
the default configuration file to the right place:

# cp php-5.2.6/php.ini-dist /home/lighttpd/lib/php.ini

Finally, we need to install XCache,

# tar zxvf xcache-1.2.2.tar.gz
# cd xcache-1.2.2
# /home/lighttpd/bin/phpize
# ./configure --enable-xcache --prefix=/home/lighttpd
# make && make test
# make install

After “make install”, it will notify you when the modules stored, by default, it’s here:

# ls /usr/local/lib/php/extensions/no-debug-non-zts-20060613/

You need to copy the file to another place. I just
moved it to /home/lighttpd/lib, and the configuration directives are
needed to run xcache, so just run the following command:

# cat xcache-1.2.2/xcache.ini && /home/lighttpd/lib/php.ini

Now, all the basic installation is finished, you can run: /home/lighttpd/bin/rc.lighttpd start to start your lighttpd instance, and perform your following testings

If you are using eaccelerator instead of xcache, the configuration parameters are mostly like this:

./configure --enable-eaccelerator=shared --with-php-config=/home/lighttpd/bin/php-config  --prefix=/home/lighttpd 
[Added at 2008-09-18]  I performed a simple testing yesterday:

Share this post

Post Comment