在Ubuntu 8.04下编译php-fpm

Posted by zuzhihui in Linux技术 on 2010/01/29 with No Comments

首先去 http://php-fpm.org/downloads/ 下载 php-5.2.10-fpm-0.5.13.diff.gz ,然后下载php的源代码 php-5.2.10.tar.bz2

然后运行命令:

tar jxf php-5.2.10.tar.bz2
cd php-5.2.10
gunzip -c ../php-5.2.10-fpm-0.5.13.diff.gz |patch -p1
apt-get install build-essential libxml2-dev libmcrypt-dev libssl-dev libldap2-dev libmhash-dev libmysqlclient15-dev libcurl4-openssl-dev libpng12-dev libjpeg-dev libsasl2-dev
./configure --prefix=/opt/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap  --without-pear --with-mysql --with-mysqli --enable-sqlite-utf8 --with-pdo-mysql --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir
make
make install
cp php.ini-dist /opt/php/lib/php.ini
ln -s /opt/php/sbin/php-fpm /etc/init.d/php-fpm
update-rc.d -f php-fpm defaults
/etc/init.d/php-fpm start

编译后的php安装在/opt/php下面,php的配置文件是/opt/php/lib/php.ini

然后运行 /etc/init.d/php-fpm start 就可以启动php的fastcgi进程了,这些php fastcgi进程应该可以正常工作了。

优化php-fpm

编辑php-fpm的配置文件/opt/php/etc/php-fpm.conf,

  • 去掉display_errors参数的注释,修改参数值为1
  • 去掉sendmail_path参数的注释
  • 去掉user,group参数的注释
  • 修改max_children参数的值为50

标签:,

Leave a Comment

Back to Top

2007-2017 © 北京瑞豪开源科技有限公司 京ICP备13004995号-2