We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
HOWTO: Install PHP7.0 or PHP 7.2 on CentOS 7
HOWTO: Install PHP7.0 or PHP 7.2 on CentOS 7
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
Last edited by SS88 on Sat Mar 17, 2018 5:05 pm, edited 3 times in total.
Re: HOWTO: Install PHP7 on CentOS 7
This command also remove roundcubemail.
yum -y remove php
yum -y remove php
Re: HOWTO: Install PHP7 on CentOS 7
I just did fresh install today on CentOS 7.2 and it did not remove Roundcube.edica wrote:This command also remove roundcubemail.
yum -y remove php
Re: HOWTO: Install PHP7 on CentOS 7
Remove roundcubemail as dependency.
-
- Posts: 1
- Joined: Sat Sep 10, 2016 8:48 am
Re: HOWTO: Install PHP7 on CentOS 7
Perfect. i have done
thank you very much!
thank you very much!
Re: HOWTO: Install PHP7 on CentOS 7
This command will remove roundcubemail.
Please use this:
Code: Select all
yum -y remove php
Please use this:
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
yum -y --enablerepo=remi-php70 upgrade php
yum -y --enablerepo=remi install roundcubemail #(will upgrade roundcubemail to 1.2)
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
-
- Posts: 301
- Joined: Tue Dec 22, 2015 2:06 pm
Re: HOWTO: Install PHP7 on CentOS 7
duy13 wrote: Please use this:
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 yum -y --enablerepo=remi-php70 upgrade php yum -y --enablerepo=remi install roundcubemail #(will upgrade roundcubemail to 1.2) 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
hi, duy13,
I used your code, but I got following result:
Code: Select all
# php -v
PHP 7.0.11 (cli) (built: Sep 14 2016 08:28:52) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
Do I need to install OPcache separately?
Thank you.
-
- Posts: 301
- Joined: Tue Dec 22, 2015 2:06 pm
Re: HOWTO: Install PHP7 on CentOS 7
hi, @edica,edica wrote:Remove roundcubemail as dependency.
You are right. When I following the topic author's steps, the "yum -y remove php" command will remove roundcubemail as dependency.
When I tried to re-install roundcubemail , it can not be done.
Why?
How to restore roundcubemail now?
Is it possible to upgrade to PHP7 WITHOUT losing roundcubemail ?
Thank you.
Re: HOWTO: Install PHP7 on CentOS 7
I don't know if you have done this but I updated the commands and removed "yum -y remove php" and now everything works as expected.baijianpeng wrote:hi, @edica,edica wrote:Remove roundcubemail as dependency.
You are right. When I following the topic author's steps, the "yum -y remove php" command will remove roundcubemail as dependency.
When I tried to re-install roundcubemail , it can not be done.
Why?
How to restore roundcubemail now?
Is it possible to upgrade to PHP7 WITHOUT losing roundcubemail ?
Thank you.
-
- Posts: 301
- Joined: Tue Dec 22, 2015 2:06 pm
Re: HOWTO: Install PHP7 on CentOS 7
Today I tried your above steps again, when I run the following command, I got error:SS88 wrote: I don't know if you have done this but I updated the commands and removed "yum -y remove php" and now everything works as expected.
Code: Select all
# service php-fpm stop
Redirecting to /bin/systemctl stop php-fpm.service
Failed to stop php-fpm.service: Unit php-fpm.service not loaded.
Thank you.
PS: I think, "service ..." is a command on CentOS 6.x, right? On CentOS 7, you should use "systemctl ... ", right? Why you still use "service ... " command on CentOS7?