一、軟件準(zhǔn)備 ============ Lighttpd:?http://www.lighttpd.net PHP:?http://www.php.com MySQL:?http://www.mysql.com eAccelerator:?http://sourceforge.net/project/showfiles.php?group_id=122249 將這些軟件都放到/usr/local/src Lighttpd依賴于pcre-de
一、軟件準(zhǔn)備
============
Lighttpd:?http://www.lighttpd.net
PHP:?http://www.php.com
MySQL:?http://www.mysql.com
eAccelerator:?http://sourceforge.net/project/showfiles.php?group_id=122249
將這些軟件都放到/usr/local/src
Lighttpd依賴于pcre-devel包,如果沒有安裝請(qǐng)下載或者從光盤中安裝。
二、安裝MySQL
=============
# cd /usr/local/src
# rpm -Uvh MySQL-client-4.0.26-0.i386.rpm
# rpm -Uvh MySQL-server-4.0.26-0.i386.rpm
# mysqladmin -u root password “new_password_for_root”
# service mysql start
三、安裝Lighttpd
================
# useradd lighttpd
# vi /etc/passwd (將lighttpd用戶的登錄shell改為/bin/nologin)
# cd /usr/local/src
# tar xzvf lighttpd-lighttpd-1.4.10.tar.gz
# cd lighttpd-lighttpd-1.4.10
# CHOST=”i686-pc-linux-gnu” CFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” CXXFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” ./configure –prefix=/usr/local/lighttpd –with-bzip2 –disable-ipv6
# make
# make install
# mkdir /usr/local/lighttpd/conf
# mkdir /usr/local/lighttpd/log
# cp ./doc/lighttpd.conf /usr/local/lighttpd/conf/
# cp ./doc/rc.lighttpd.redhat /etc/rc.d/init.d/lighttpd
# chown root:root /etc/rc.d/init.d/lighttpd
# chmod 755 /etc/rc.d/init.d/lighttpd
# chkconfig –add lighttpd
# cp ./doc/spawn-php.sh /usr/local/lighttpd/bin/
# vi /usr/local/lighttpd/bin/spawn-php.sh
以下是spawn-php.sh需要修改的部分:
SPAWNFCGI=”/usr/local/lighttpd/bin/spawn-fcgi”
FCGIPROGRAM=”/usr/local/php-fcgi/bin/php”
USERID=lighttpd
GROUPID=lighttpd
# chown -R lighttpd:lighttpd /usr/local/lighttpd
# vi /usr/local/lighttpd/conf/lighttpd.conf
以下是lighttpd.conf中需要修改的部分:
server.document-root = “/usr/local/lighttpd/html”
server.errorlog = “/usr/local/lighttpd/log/lighttpd.error.log”
accesslog.filename = “/usr/local/lighttpd/log/access.log”
server.pid-file??????????? = “/var/run/lighttpd.pid”
server.username = “lighttpd”
server.groupname = “lighttpd”
compress.cache-dir???????? = “/tmp”
compress.filetype????????? = (“text/plain”, “text/html”)
fastcgi.server???????????? = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/php-fcgi/bin/php”
)
)
)
四、安裝PHP
===========
# cd /usr/local/src
# tar xzvf php-4.2.2.tar.gz
# cd php-4.4.2
# CHOST=”i686-pc-linux-gnu” CFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” CXXFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” ./configure –prefix=/usr/local/php-fcgi –enable-fastcgi –with-mysql –enable-zend-multibyte –with-config-file-path=/usr/local/php-fcgi/etc –enable-discard-path –enable-force-cgi-redirect –with-gd –enable-gd-native-ttf –enable-gd-jis-conv –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –enable-xml –enable-mbstring
# make
# make install
# cp php.ini-dist /etc/php.ini
五、安裝eAccelerator
====================
# /usr/local/src
# bunzip2 -d eaccelerator-0.9.4.tar.bz2
# tar -xvf eaccelerator-0.9.4.tar
# cd eaccelerator-0.9.4
# export PHP_PREFIX=”/usr/local/php-fcgi”
# $PHP_PREFIX/bin/phpize
# CHOST=”i686-pc-linux-gnu” CFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” CXXFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” ./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
# make
# make install
(eAccelerator安裝在/usr/local/php-fcgi/lib/php/extensions/no-debug-non-zts-XXXXXXXX)
# cat eaccelerator.ini >> /usr/local/php-fcgi/etc/php.ini
# vi /usr/local/php-fcgi/etc/php.ini
//全局部分
cgi.fix_pathinfo = 1
extension_dir = “/usr/local/php-fcgi/lib/php/extensions/no-debug-non-zts-XXXXXXXX”
zlib.output_compression = On
//eAccelerator部分
zend_extension = “/usr/local/php-fcgi/lib/php/extensions/no-debug-non-zts-XXXXXXXX/eaccelerator.so”
eaccelerator.shm_size = “0″
eaccelerator.cache_dir = “/tmp”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″
eaccelerator.debug = 0
eaccelerator.log_file = “/var/log/eaccelerator_log”
eaccelerator.name_space = “”
eaccelerator.check_mtime = “1″
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″
eaccelerator.keys???? = “shm_and_disk”
eaccelerator.sessions = “shm_and_disk”
eaccelerator.content = “shm_and_disk”
eaccelerator.admin.name = “SET_USERNAME”
eaccelerator.admin.password = “SET_PASSWORD”
六、啟動(dòng)PHP-FastCGI
===================
# /usr/local/lighttpd/bin/spawn-php.sh
七、啟動(dòng)Lighttpd
================
# vi /etc/rc.d/init.d/lighttpd (檢查腳本將文件中的路徑設(shè)置為本機(jī)環(huán)境路徑,例如Lighttpd配置文件位置)
# service lighttpd start
八、測(cè)試
========
# ps aux | grep php
原文地址:Lighttpd + PHP-FastCGI + MySQL + eAccelerator安裝, 感謝原作者分享。
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com