CentOS 6.5下PHP 5.6编译安装

发布时间:2019-06-14 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了CentOS 6.5下PHP 5.6编译安装脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

编译前执行下列命令

#添加组
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自行修改

./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为默认库路径

脚本宝典总结

以上是脚本宝典为你收集整理的CentOS 6.5下PHP 5.6编译安装全部内容,希望文章能够帮你解决CentOS 6.5下PHP 5.6编译安装所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。