HowTo: Setup Lighttpd + PHP + eAccelerator

Posted at 2008/04/06 21:49 // in Linux // by 엔신
HowTo: Setup Lighttpd + PHP + eAccelerator

This guide will teach you how to install lighttpd with php support and eAccelerator



1st thing we need to do is to create a directory where we will download all the installtion files into it.

mkdir /root/installers
cd /root/installers



1. Download Lighttpd

wget http://www.lighttpd.net/download/lighttpd-1.4.15.tar.gz



2. Download PHP & FastCGI

wget http://www.fastcgi.com/dist/fcgi.tar.gz
wget http://il2.php.net/get/php-4.4.6.tar.gz/from/www.php.net/mirror



3. Download eAccelerator

wget http://bart.eaccelerator.net/source/0.9.5/eaccelerator-0.9.5.tar.bz2



4. Make Sure the following packages installed. pcre-devel, libpng-devel, libjpeg-devel,lib-gd

up2date -i pcre-devel libpng-devel libjpeg-devel lib-gd



5. Create the directories for compiling lighty

mkdir -p /www/service/
mkdir -p /www/service/logs
mkdir -p /www/service/config



6. Untar all packages

tar xzvfp lighttpd-1.4.15.tar.gz
tar xzvfp fcgi.tar.gz
tar xzvfp php-4.4.6.tar.gz
tar xjvfp eaccelerator-0.9.5.tar.bz2



7. Comiple Lighttpd

cd lighttpd-1.4.15/
./configure --prefix=/www/service
make
make install



8.a. Comiple FastCGI

cd ..
cd cd fcgi-2.4.0/
./configure
make
make install



8.b. Compile PHP (Here is disabled pear support '--without-pear') you can remove it if you need pear support

cd ..
cd php-4.4.6/
./configure --enable-fastcgi --with-curl --with-mysql=/usr/local/mysql \
           --enable-sysvshm --enable-sysvsem --enable-sysvmsg --with-gd \
           --with-zlib --without-pear
make
make install



9. create a copy for php.ini

cp -a php.ini-recommended /usr/local/lib/php/php.ini



10. Compile eAccelerator

cd ..
cd eaccelerator-0.9.5
export PHP_PREFIX="/usr/local"
$PHP_PREFIX/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
make install



11. Add eAccelerator Config to php.ini (add the lines into the end of the php file)

vi /usr/local/lib/php/php.ini

zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"




10 . Make sure it's working type (php -v) you should get something like this.

php -v
PHP 4.4.6 (cgi-fcgi) (built: Apr 29 2007 17:14:12)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
   with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator



11. Create Lighttpd Config Files.

cp -a /root/installers/lighttpd-1.4.15/doc/lighttpd.conf /www/service/config/



12. Edit Lighttpd config file (vi /www/service/config/lighttpd.conf)

vi /www/service/config/lighttpd.conf



12.a. Add the following line into the end of the file.

  #fastcgi.debug = 1
     fastcgi.server = (".php" =>
        ("lighttpd-php" =>
           ("socket" => "/tmp/lighttpd-php.sock",
            "bin-path" => "/usr/local/bin/php",
                    "max-procs" => 2,
                    "bin-environment" => (
                      "PHP_FCGI_CHILDREN" => "16",
                      "PHP_FCGI_MAX_REQUESTS" => "10000"
                    ),
                    "bin-copy-environment" => (
                      "PATH", "SHELL", "USER"
                    )
           )
     )
  )



13. Try IT

/www/service/sbin/lighttpd -f /www/service/config/lighttpd.conf

http://www.82i.com/@/zboard.php?id=faq&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=41

이올린에 북마크하기
2008/04/06 21:49 2008/04/06 21:49

http://www.rain9.com/tc/trackback/81