HOWTO: Install PHP7.0 or PHP 7.2 on CentOS 7
Posted: Fri Aug 05, 2016 1:43 pm
Note: This is only for NGINX + PHP-FPM VestaCP installs.
PHP 7.2 install is located here: viewtopic.php?f=11&t=12319&p=68007#p68007
BELOW IS PHP 7.0 INSTALL!
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
Now remove old PHP and install PHP7
Remove and re-link new PHP7
Test if we have PHP 7
Output should be (take note of PHP 7!!)
Now open up new PHP-FPM.conf ( /etc/opt/remi/php70/php-fpm.conf ) file and change line 11 to:
Start PHP-FPM
Remove old systemctl php-fpm and link to new one
Reload systemctl daemon
Restart web service (i use nginx)
PHP 7.2 install is located here: viewtopic.php?f=11&t=12319&p=68007#p68007
BELOW IS PHP 7.0 INSTALL!
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.
Code: Select all
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
Code: Select all
yum --enablerepo=remi update remi-release
Code: Select all
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
Code: Select all
rm -f /usr/bin/php
ln -s /usr/bin/php70 /usr/bin/php
Code: Select all
php -v
Code: Select all
[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
Code: Select all
include=/etc/php-fpm.d/*.conf
Code: Select all
service php70-php-fpm start
Code: Select all
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
Code: Select all
systemctl daemon-reload
Code: Select all
service nginx restart