CentOS 6.5下PHP 5.6编译安装

编译前执行下列命令

sh#添加组
groupadd www
#添加php-fpm用户
useradd -c php-fpm-user -g www -M php-fpm
# c和c++编译器
yum install -y gcc gcc-c++
# PHP扩展依赖
yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel

编译指令

prefix自行修改

sh./configure --prefix=/data/soft/php\
 --with-libdir=lib64\
 --enable-fpm\
 --with-fpm-user=php-fpm\
 --with-fpm-group=www\
 --enable-mysqlnd\
 --with-mysql=mysqlnd\
 --with-mysqli=mysqlnd\
 --with-pdo-mysql=mysqlnd\
 --enable-opcache\
 --enable-pcntl\
 --enable-mbstring\
 --enable-soap\
 --enable-zip\
 --enable-calendar\
 --enable-bcmath\
 --enable-exif\
 --enable-ftp\
 --enable-intl\
 --with-openssl\
 --with-zlib\
 --with-curl\
 --with-gd\
 --with-zlib-dir=/usr/lib\
 --with-png-dir=/usr/lib\
 --with-jpeg-dir=/usr/lib\
 --with-gettext\
 --with-mhash\
 --with-ldap

编译完一些后续工作

# 设置php-fpm开机自动启动
chmod +x /etc/init.d/php-fpm
chkconfig php-fpm on
cp /data/soft/php/etc/php-fpm.conf.default /data/soft/php/etc/php-fpm.conf
service php-fpm start

编译选项说明

  • enable-pcntl 进程控制,默认关闭,编译开启
  • enable-opcache
    PHP编译字节码缓存,如果需要将 Xdebug 扩展和 OPcache 一起使用,必须在 Xdebug 扩展之前加载 OPcache 扩展

使用以下配置可使PHP活得较好性能,
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

  • enable-soap 简单对象访问协议,使用xml传输数据,目前已经不常用
  • enable-zip zip文件处理
  • enable-calendar 日历处理
  • enable-bcmath 任意精度数学扩展

  • enable-exif
    exif(可交换图像文件格式),专门为数码相机和照片设定,记录数码照片的属性信息和拍摄数据

Windows 用户必须在 php.ini 中启用 php_mbstring.dll 和 php_exif.dll 扩展。 请确保在 php.ini 中保持正确的顺序: php_mbstring.dll 必须在 php_exif.dll 之前 加载。

  • enable-intl 国际化支持
  • enable-mbstring 宽字符支持
  • with-gettext 语言翻译
  • with-mhash hash库支持
  • with-ldap ldap支持
  • with-libdir=lib64 如果64位操作系统,指定为/usr/lib64为默认库路径
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值