Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

HOWTO: Install PHP7.0 or PHP 7.2 on CentOS 7

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
103 posts
  • Page 1 of 11
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 11
  • Next
SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

HOWTO: Install PHP7.0 or PHP 7.2 on CentOS 7
  • Quote

Post by SS88 » 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.

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
Then enable Remi

Code: Select all

yum --enablerepo=remi update remi-release
Now remove old PHP and install PHP7

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
Remove and re-link new PHP7

Code: Select all

rm -f /usr/bin/php
ln -s /usr/bin/php70 /usr/bin/php
Test if we have PHP 7

Code: Select all

php -v
Output should be (take note of PHP 7!!)

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
Now open up new PHP-FPM.conf ( /etc/opt/remi/php70/php-fpm.conf ) file and change line 11 to:

Code: Select all

include=/etc/php-fpm.d/*.conf
Start PHP-FPM

Code: Select all

service php70-php-fpm start
Remove old systemctl php-fpm and link to new one

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
Reload systemctl daemon

Code: Select all

systemctl daemon-reload
Restart web service (i use nginx)

Code: Select all

service nginx restart
Last edited by SS88 on Sat Mar 17, 2018 5:05 pm, edited 3 times in total.
Top

edica
Posts: 126
Joined: Tue May 26, 2015 7:31 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by edica » Sat Sep 03, 2016 10:36 pm

This command also remove roundcubemail.

yum -y remove php
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by SS88 » Tue Sep 06, 2016 11:54 pm

edica wrote:This command also remove roundcubemail.

yum -y remove php
I just did fresh install today on CentOS 7.2 and it did not remove Roundcube.
Top

edica
Posts: 126
Joined: Tue May 26, 2015 7:31 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by edica » Wed Sep 07, 2016 2:11 pm

Remove roundcubemail as dependency.

Image
Top

anonymous.it.2016
Posts: 1
Joined: Sat Sep 10, 2016 8:48 am

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by anonymous.it.2016 » Sat Sep 10, 2016 8:53 am

Perfect. i have done

thank you very much!
Top

duy13
Posts: 13
Joined: Wed Jul 06, 2016 2:53 am

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by duy13 » Wed Sep 21, 2016 1:46 am

This command will remove roundcubemail.

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
Top

baijianpeng
Posts: 301
Joined: Tue Dec 22, 2015 2:06 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by baijianpeng » Tue Sep 27, 2016 10:56 am

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
These is no "with Zend OPcache v7.0.9" in my installation. Why?

Do I need to install OPcache separately?

Thank you.
Top

baijianpeng
Posts: 301
Joined: Tue Dec 22, 2015 2:06 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by baijianpeng » Wed Sep 28, 2016 2:25 pm

edica wrote:Remove roundcubemail as dependency.

Image
hi, @edica,

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.
Top

SS88
Posts: 336
Joined: Thu Nov 19, 2015 12:40 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by SS88 » Sun Oct 09, 2016 2:27 pm

baijianpeng wrote:
edica wrote:Remove roundcubemail as dependency.

Image
hi, @edica,

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.
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.
Top

baijianpeng
Posts: 301
Joined: Tue Dec 22, 2015 2:06 pm

Re: HOWTO: Install PHP7 on CentOS 7
  • Quote

Post by baijianpeng » Wed Oct 12, 2016 10:56 am

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.
Today I tried your above steps again, when I run the following command, I got error:

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.
Did I missed something?

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?
Top


Post Reply
  • Print view

103 posts
  • Page 1 of 11
    • Jump to page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • …
  • 11
  • Next

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password