Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
NickTheGreek

HOWTO: Install PHP7 on CentOS 7

Recommended Posts

This tutorial REPLACES PHP 5.X COMPLETELY. Do NOT use it if you want multiple PHP versions.

If you have REMI Repository you can skip this step.
 

Then enable Remi
 

 

yum --enablerepo=remi update remi-release


Now remove old PHP and install PHP7
 

 

service php-fpm stop
yum -y --enablerepo=remi 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


Remove and re-link new PHP7
 

 

rm -f /usr/bin/php
ln -s /usr/bin/php70 /usr/bin/php


Test if we have PHP 7
 

 

php -v


Output should be (take note of PHP 7!!)
 

 

[root@tiny system]# php -v
PHP 7.0.9 (cli) (built: Jul 20 2016 16:58:48) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.9, Copyright (c) 1999-2016, by Zend Technologies


Now open up new PHP-FPM.conf ( /etc/opt/remi/php70/php-fpm.conf ) file and change line 11 to:
 

 

include=/etc/php-fpm.d/*.conf


Start PHP-FPM
 

 

service php70-php-fpm start


Remove old systemctl php-fpm and link to new one
 

 

rm -f /usr/lib/systemd/system/php-fpm.service
ln -s /usr/lib/systemd/system/php70-php-fpm.service /usr/lib/systemd/system/php-fpm.service


Reload systemctl daemon
 

 

systemctl daemon-reload


Restart web service (i use nginx)
 

 

service nginx restart

 

 

https://forum.vestacp.com/viewtopic.php?t=12319

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×