CentOS-6.7 编译安装 PHP-7.1.5

前端之家收集整理的这篇文章主要介绍了CentOS-6.7 编译安装 PHP-7.1.5前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

环境:CentOS-6.7-x86_64-bin-DVD1.iso

其他依赖包的安装,这里省略了,得承认这个过程也是件麻烦的事情。

来吧,直奔主题

tar -zxvf PHP-7.1.5.tar.gz
cd PHP-7.1.5
./configure \
--prefix=/usr/local/PHP-7.1.5 \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-MysqLi=MysqLnd \
--with-pdo-MysqL=MysqLnd \
--with-config-file-path=/usr/local/PHP-7.1.5/etc \
--with-config-file-scan-dir=/usr/local/PHP-7.1.5/etc/PHP.d \
--with-mcrypt=/usr/local/libmcrypt \
--with-png-dir=/usr/local/libpng \
--with-jpeg-dir \
--with-freetype-dir \
--with-bz2 \
--with-curl \
--with-gd \
--with-mhash \
--with-openssl \
--with-zlib \
--with-gettext \
--with-xmlrpc \
--enable-MysqLnd \
--enable-bcmath \
--enable-fpm \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-zip
make 
make test
make install

cp PHP.ini-production /usr/local/PHP-7.1.5/etc/PHP.ini

相比我本地旧版 PHP-5.3 还缺少:
ereg
libevent
mhash

说明:
--with-MysqL        // 已被弃用
MysqLnd            // PHP5.3 以后 PHP 内置的 MysqL 客服端驱动,以往使用的是 MysqL 提供的驱动 libMysqL
ereg        // PHP5.3 开始不建议使用,PHP7 废除
mhash        // PHP5.3 开始,mhash 是通过 hash 扩展来模拟的

安装 memcached 扩展
http://libmemcached.org/libMemcached.html
tar -zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure -prefix=/usr/local/libmemcached --with-memcached
make && make install
http://pecl.PHP.net/package/memcached
tar -zxvf memcached-3.0.3.tgz
cd memcached-3.0.3
/usr/local/PHP-7.1.5/bin/PHPize
./configure --with-libmemcached-dir=/usr/local/libmemcached --with-PHP-config=/usr/local/PHP-7.1.5/bin/PHP-config
make && make install
/usr/local/PHP-7.1.5/lib/PHP/extensions/no-debug-zts-20160303/memcached.so
vi /usr/local/PHP-7.1.5/etc/PHP.ini
extension=/usr/local/PHP-7.1.5/lib/PHP/extensions/no-debug-zts-20160303/memcached.so
/usr/local/apache/bin/apachectl -k restart

安装 redis 扩展
http://pecl.PHP.net/package/redis
tar -zxvf redis-3.1.2.tgz
cd redis-3.1.2
/usr/local/PHP-7.1.5/bin/PHPize
./configure --with-PHP-config=/usr/local/PHP-7.1.5/bin/PHP-config
make && make install
/usr/local/PHP-7.1.5/lib/PHP/extensions/no-debug-zts-20160303/redis.so
vi /usr/local/PHP-7.1.5/etc/PHP.ini
extension=/usr/local/PHP-7.1.5/lib/PHP/extensions/no-debug-zts-20160303/redis.so
/usr/local/apache/bin/apachectl -k restart

如果你也使用的 Apache:

vi /usr/local/apache/conf/httpd.conf
#LoadModule PHP5_module        modules/libPHP5.so
LoadModule PHP7_module        modules/libPHP7.so

/usr/local/apache/bin/apachectl -k restart
原文链接:https://www.f2er.com/centos/377524.html

猜你在找的CentOS相关文章