1 安装依赖
yum -y install gcc gcc-c++ bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2 libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel jemalloc jemalloc-devel freetype-devel libpng libpng-devel libjpeg-devel
2 编译参数
cd php-5.6.25
groupadd www
useradd -g www -s /sbin/nologin www
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-inline-optimization --disable-debug \
--disable-rpath --enable-shared --enable-opcache \
--enable-fpm \
--with-png-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-gd \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir=/usr/ \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl --with-zlib \
--enable-zip \
--with-bz2 \
--with-readline
3 编译 安装
make && make install
4 配置php-fpm
配置文件
cp php.ini-development /usr/local/php/etc/php.ini
php-fpm 服务
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig on php-fpm
service php-fpm start
5 php添加到环境变量
vim /etc/profile
添加
PATH=$PATH:/usr/local/php/bin
export PATH
source /etc/profile
6 修好Nginx配置
查看php的编译参数
php -i |grep configure