文本版|topic 高级搜索
   名人堂 帮助 论坛制度 意见反馈 | 首页 博客 周新贴 招聘 专题 新闻
RSS 底部
 
社区导航: 专家门诊   网络技术   操作系统   数据库   程序设计   系统应用   考试认证   CIO及信息化   站长交流   综合交流   下载基地  51CTO产品服务 设为首页 | 收藏本站
51CTO技术论坛» Linux & Advanced Application » Lighttpd + PHP-FastCGI + MySQL + eAccelerator 环境配置       [ 打印]  [ 订阅]  [ 收藏]  [ 推荐给朋友]   [ 本帖文本页]

论坛跳转:
     
标题: [转载] Lighttpd + PHP-FastCGI + MySQL + eAccelerator 环境配置  ( 查看:209  回复:1 )   
 
流星☆
主版主  点击可查看详细


内阁大臣   诚信兄弟   行业勋章   技术勋章   十二生肖之狗   水瓶座   中秋活动勋章  
帖子 2114
精华 1
无忧币 6359
积分 3685
阅读权限 150
来自 (保密)
注册日期 2006-4-7
最后登录 2008-7-5 离线

[查看资料]  [发短消息]  [Blog
[个人主页]    QQ    ICQ 状态      淘宝旺旺 
发表于:2008-3-13 22:55   标题:Lighttpd + PHP-FastCGI + MySQL + eAccelerator 环境配置
上一帖 |
一、软件准备
============
Lighttpd: http://www.lighttpd.net
PHP: http://www.php.net
MySQL: http://www.mysql.com
eAccelerator: http://sourceforge.net/project/showfiles.php?group_id=122249
将这些软件都放到/usr/local/src

Lighttpd依赖于pcre-devel包,如果没有安装请下载或者从光盘中安装。

二、安装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
# ./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
# ./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
# ./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"

六、启动PHP-FastCGI
===================
# /usr/local/lighttpd/bin/spawn-php.sh

七、启动Lighttpd
================
# vi /etc/rc.d/init.d/lighttpd (检查脚本将文件中的路径设置为本机环境路径,例如Lighttpd配置文件位置)
# service lighttpd start

八、测试
========
# ps aux | grep php



乐观、进取、奋斗,是生活的态度; 学业、事业、健身,是生命的内容; 爱情、友情、亲情,是生命的目标!
2008-3-13 22:551楼
[ 顶部 ]
 
termite3304
副版主  点击可查看详细


十二生肖之虎   白羊座   行业勋章   技术勋章   诚信兄弟   专家门诊活动纪念勋章  
帖子 1608
精华 4
无忧币 34672
积分 3148
阅读权限 140
注册日期 2007-8-1
最后登录 2008-7-6 在线

[查看资料]  [发短消息]  [Blog
[个人主页]         
发表于:2008-3-14 19:12 
支持! 有时间要试试.



猜奥运金牌,赢无忧币
2008-3-14 19:122楼
[ 顶部 ]
     
论坛跳转:  

| | |

| | |

标记已读 · 删除论坛Cookies · 文本版 · WAP
 
| 诚征版主 | 版主堂 | 意见建议 | 大史记 | 论坛地图
Copyright©2005-2008 51CTO.COM  Powered by Discuz!
本论坛言论纯属发布者个人意见,不代表51CTO网站立场!如有疑义,请与管理员联系。
京ICP备05051492号