首页 Install PHP 5.6 on CentOS 7 Server

Install PHP 5.6 on CentOS 7 Server

子恒 2017-10-13 1 1110

转自: https://blog.hostonnet.com/install-php-5-6-on-centos-7-server

CentOS 7 come with outdated PHp 5.4 for some strange reason only enterprise can understand. I normally prefer Ubuntu 16.04 over CentOS 7 because it come with latest software. Default PHP version with Ubuntu 16.04 is 7.

To install PHP 5.6 on CentOS 7, you need to install remi repository.


yum install -y epel-release
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -ivh remi-release-7.rpm
yum update


If you have older version of PHP, uninstall it with

yum remove php-pdo php-odbc php-xml php-soap php-cli php-devel php-pspell php php-intl php-xmlrpc php-process php-common php-gd php-mysqlnd php-mbstring

Now you can install PHP 5.6 with

yum install php56 php56-php php56-php-mysqlnd php56-php-gd php56-php-mcrypt php56-php-mbstring php56-php-xml php56-php-cli

If you need ioncube loader, install it with

yum install php56-php-ioncube-loader

php-fpm

if you want to use php-fpm, then install

yum install php56-php-ioncube-loader

You can edit php-fpm pool config with

vi /opt/remi/php56/root/etc/php-fpm.d/ www.conf

Start/stop/restart php-fpm with

systemctl start php56-php-fpm
systemctl stop php56-php-fpm
systemctl restart php56-php-fpm

In your Apache virtual host file or global Apache config, add

<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

If you want multiple php version, use different ports or sockets for each php-fpm installation and add the entry in virtual host.

Tags:

免责声明:本文仅代表作者个人观点,与本网站无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
作者: 子恒 本文发布于2017-10-13 05:34:50
子恒

前端工程师,emlog模版beginning开发者

作者的微博

发表评论

评论列表:

。。。
2018-10-11 15:12
谢谢博主获益匪浅