Skip to content

Instantly share code, notes, and snippets.

@luxixing
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luxixing/262397daf6ff0f841e9b to your computer and use it in GitHub Desktop.
Save luxixing/262397daf6ff0f841e9b to your computer and use it in GitHub Desktop.
CentOS 6.5下PHP-6.4编译安装

####编译前执行下列命令####

#添加组
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

####编译指令####

./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

####编译选项说明#### 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为默认库路径

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment