乐心
Always dream. Always explore.
乐心的博客
centos6下安装php7

删除旧版本php

yum remove php* php-common

更新软件源

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm

安装php7

yum install php70-php php70-php-pear php70-php-bcmath php70-php-pecl-jsond-devel php70-php-mysqlnd php70-php-gd php70-php-common php70-php-fpm php70-php-intl php70-php-cli php70-php php70-php-xml php70-php-opcache php70-php-pecl-apcu php70-php-pecl-jsond php70-php-pdo php70-php-gmp php70-php-process php70-php-pecl-imagick php70-php-devel php70-php-mbstring php70-php-mcrypt

查看php70和php70-php-fpm的安装路径

rpm -qa php70
# php70-1.0-5.el6.remi.x86_64
rpm -ql php70-1.0-5.el6.remi.x86_64
(contains no files)
#######
rpm -qa php70-php-fpm
# php70-php-fpm-7.0.8-1.el6.remi.x86_64
rpm -ql php70-php-fpm-7.0.8-1.el6.remi.x86_64
# /etc/logrotate.d/php70-php-fpm
# /etc/opt/remi/php70/php-fpm.conf # php-fpm的配置文件
# /etc/opt/remi/php70/php-fpm.d
# /etc/opt/remi/php70/php-fpm.d/www.conf # www的配置文件
# /etc/opt/remi/php70/sysconfig/php-fpm
# /etc/rc.d/init.d/php70-php-fpm
# /opt/remi/php70/root/usr/sbin/php-fpm # 二进制的位置
# /opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8
# /opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8/fpm_LICENSE
# /opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8/php-fpm.conf.default
# /opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8/www.conf.default
# /opt/remi/php70/root/usr/share/fpm
# /opt/remi/php70/root/usr/share/fpm/status.html
# /opt/remi/php70/root/usr/share/man/man8/php-fpm.8.gz
# /var/opt/remi/php70/lib/php/opcache
# /var/opt/remi/php70/lib/php/session
# /var/opt/remi/php70/lib/php/wsdlcache
# /var/opt/remi/php70/log/php-fpm
# /var/opt/remi/php70/run/php-fpm

可以看到, rpm -ql php70-php-fpm-7.0.8-1.el6.remi.x86_64并没有列出php70的文件详细信息,根据中的解释, yum默认把软件包安装在以下位置

二进制: /usr/bin
类库: /usr/lib
头文件: /usr/include  所以,我们可以在/usr/bin中找到php70

为php和php-fpm制作符号链接

cp /usr/bin/php{,.bak}
ln -s /usr/bin/php70 /usr/bin/php
cp /usr/sbin/php-fpm{,.bak}
ln -s /opt/remi/php70/root/usr/sbin/php-fpm /usr/sbin/php-fpm

安装PHP7 redis扩展

yum list | grep redis
Repository epel is listed more than once in the configuration
php70-php-pecl-redis.x86_64              3.1.2-1.el6.remi             @remi-safe
redis.x86_64                             2.4.10-1.el6                 @epel
hiredis-last.x86_64                      0.13.3-1.el6.remi            remi-safe
php-nrk-Predis.noarch                    0.8.6-1.el6                  epel
php-pecl-redis.x86_64                    2.2.8-1.el6                  epel
php-redis.x86_64                         2.2.2-5.git6f7087f.el6       epel
php54-php-pecl-redis.x86_64              3.1.2-1.el6.remi             remi-safe
php54-php-phpiredis.x86_64               1.0.0-1.el6.remi             remi-safe
php55-php-pecl-redis.x86_64              3.1.2-1.el6.remi             remi-safe
php55-php-phpiredis.x86_64               1.0.0-1.el6.remi             remi-safe
php56-php-pecl-redis.x86_64              3.1.2-1.el6.remi             remi-safe
php56-php-phpiredis.x86_64               1.0.0-1.el6.remi             remi-safe
php70-php-phpiredis.x86_64               1.0.0-1.el6.remi             remi-safe
php71-php-pecl-redis.x86_64              3.1.2-1.el6.remi             remi-safe
php71-php-phpiredis.x86_64               1.0.0-2.el6.remi             remi-safe
python-redis.noarch                      2.0.0-1.el6                  epel
uwsgi-logger-redis.x86_64                2.0.15-1.el6                 epel
uwsgi-router-redis.x86_64                2.0.15-1.el6                 epel
#看到上面的php70-php-phpiredis.x86_64 安装这个php70-php-phpiredis.x86_64即可
yum install -y php70-php-phpiredis.x86_64
#完成
如果喜欢这篇文章,欢迎推荐给你的朋友

推荐文章

发表评论

textsms
account_circle
email

乐心的博客

centos6下安装php7
删除旧版本phpyum remove php* php-common 更新软件源wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm wget http://rpms.remirepo.net/enterprise/remi-re…
扫描二维码继续阅读
2017-06-18