Php533+php-fpm源码安装

本文详细介绍如何通过PECL安装并配置PHP扩展如memcache、APC和Imagick等,以及手动编译PHP时所需的参数说明。同时,还介绍了如何配置php-fpm以优化PHP的性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • pecl扩展(以下的pecl源码改名后放到php源码的ext目录下)
    i.memcache-3.0.4->memcache
    ii.APC-3.1.4->apc
    iii.imagick-3.0.0->imagick

(已经把memcache,apc模块源码放到ext子目录中,名称如上)

#cd /your/phpsrcdir

#rm configure

#./buildconf --force

#./configure --help(选项出现了!)

  • 预装软件:

ImageMagick

#make WITHOUT_X11=yes install clean


(时间较长,干点别的去)

libevent(php-fpm需要,ports)

#make install clean

curl(ports)

#make install clean

libmcrypt(ports)

#make install clean

  • 手动编译php,每个参数都要知道具体是干嘛的,5.3.3之后,有了php-fpm,--enable-fastcgi就不再需要了,mysqli以及pdo-mysql都用mysqlnd

#'./configure' '--prefix=/usr/local/php5_admin' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/php5_admin/etc/php' '--disable-all' '--enable-dom' '--enable-filter' '--enable-hash' '--enable-json' '--with-mcrypt' '--with-curl' '--with-pcre-regex' '--enable-mbstring' '--enable-ctype' '--enable-session' '--enable-libxml' '--enable-simplexml' '--enable-pdo' '--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-sysvsem' '--enable-sysvshm' '--enable-apc' '--enable-memcache' '--with-imagick=/usr/local' '--enable-fpm' '--with-gd' '--enable-gd-native-ttf' '--with-mysql'

  • 配置
    #cp /usr/local/php5_admin/etc/php-fpm.conf.default /usr/local/php5_admin/etc/php-fpm.conf
    
    

    几个需要配置的参数
    pm.max_children
    pm.start_servers
    pm.min_spare_servers
    pm.max_spare_servers

启动脚本
/usr/local/etc/rc.d/phpfpm

#!/bin/sh

# PROVIDE: phpfpm

# REQUIRE: DAEMON

#

# Add the following lines to /etc/rc.conf to run phpfpm:

#

# phpfpm_enable (bool):   Set it to "YES" to enable {phpfpm}.

#               Default is "NO".

#

# Last-Modified: 2010-09-14 23:30:20

name="phpfpm" 



. /etc/rc.subr

rcvar=`set_rcvar`

load_rc_config ${name}



eval ${name}_enable=/${${name}_enable:-"NO"}

eval server=/${${name}_server:-"/usr/local/php5_admin/sbin/php-fpm"}



command=${server}



extra_commands="reload" 



sig_reload="USR2" 



pidfile="/usr/local/php5_admin/var/run/php-fpm.pid" 

#command_args="" 

run_rc_command "$1" 

在/etc/rc.conf中加入phpfpm_enable="YES"

#/usr/local/etc/rc.d/phpfpm start


启动ok

 

 

注:

1  ./buildconf --force 时,可能会报autoconf version 6.68错误

解决把它卸载,

pkg_info | grep "autoconf"
然后根据输出的autoconf名
pkg_delete autoconf6.68

 

出现 “configure: error: Cannot find MySQL header files under yes.”错误 解决:

http://blog.sina.com.cn/s/blog_56a70c0401000are.html

 

==============================================

点缀娱乐 点缀娱乐 点缀娱乐 点缀娱乐 点缀娱乐 点缀娱乐 点缀娱乐 点缀娱乐 

==============================================

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值