php5.6.x独立编译安装


安装依赖

yum -y install gcc gcc-c++ autoconf automake bison cmake curl curl-devel libzip libXpm libcurl-devel zlib-devel libcom_err-devel libpng-devel  libjpeg* libsepol-devel libselinux-devel openssl openssl-devel pcre-devel php-common php-gd  wget zlib ncurses-devel libxml2 libxml2-devel gd-devel flex  bzip2 libmcrypt  yasm nasm readline-devel libvpx-devel t1lib*



安装libmcrypt(php扩展)

wget -c https://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure && make && make install



编译安装PHP 5.6.31

wget -c http://mirrors.sohu.com/php/php-5.6.31.tar.gz
tar -zxvf php-5.6.31.tar.gz
cd php-5.6.31
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=mysqlnd --with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-vpx-dir=/usr \
--with-t1lib=/usr \
--with-libxml-dir=/usr/include/libxml2/libxml \
--with-openssl-dir=/usr \
--with-openssl \
--without-pear \
--with-gettext \
--with-readline \
--with-mhash \
--with-mcrypt \
--with-xmlrpc \
--with-iconv \
--with-curl \
--with-zlib \
--with-bz2 \
--with-gd \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-session \
--enable-sockets \
--enable-sysvsem \
--enable-sysvmsg \
--enable-sysvshm \
--enable-opcache \
--enable-mbregex \
--enable-libxml \
--enable-bcmath \
--enable-shmop \
--enable-pcntl \
--enable-ctype \
--enable-soap \
--enable-fpm \
--enable-ftp \
--enable-zip \
--enable-cli \
--enable-xml

配置完成效果

make #进入漫长的编译过程中...

编译完成

make install  # 安装

这里写图片描述



文件配置

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

ln -sb /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf



编辑配置文件

vi /etc/php-fpm.conf
pid = run/php-fpm.pid #取消前面的分号
vi  /etc/php.ini
date.timezone = Asia/Shanghai
expose_php = Off #禁止显示php版本的信息
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"



测试php-fpm配置

/usr/local/php/sbin/php-fpm -t
[26-Aug-2017 10:28:37] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
ln -sb /usr/local/php/bin/php /usr/bin/
php -v
PHP 5.6.31 (cli) (built: Aug 26 2017 10:00:00) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies



设置 php-fpm开机启动

cp /root/php-5.6.3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm

chmod 755 /etc/rc.d/init.d/php-fpm

chkconfig php-fpm on


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值