Page 1 of 2

How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Thu Jan 04, 2018 9:29 am
by wedge1001
Hello,

despite of searching a lot in google, in the forums etc. i don't really found a solution for my problem:
i'm using vestacp for a few month now and are super happy.
now I wanted to upgrade to php7.x (.0 or .1 doesn't really matter to me, yet)

Most of the tutorials are for apache with nginx proxy - but that's not what i want to have.
i want to have a "pure" nginx + php-fpm configuration.

After following the tutorials I now have php5-fpm and php7-fpm running in parallel.
(php5 configured through vestacp and 7 through OS)

BUT:

how do I have to modify the php7 configs to move the new system?
As far as I have seen, the settings for php5-fpm are heavily changed from vestacp.

when editing the php-fpm config in advanced mode it now shows me this as the first line, right above the editor:

Code: Select all

/etc/php/7.0/fpm/php.ini /etc/php5/fpm/php.ini

As a matter of fact, I don't really need php5 - so I can theoretically remove it, but I don't want to remove it yet, since I don't know how to move over the configs to 7.

More-Info:
OS: Debian 8
frontend: nginx
backend: php-fpm


Also I have a bonus-Question: Where can I see which vestacp-Version I'm running?

I hope this is the right place for posting my problem.

Thanks for your help!

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Tue Jan 09, 2018 7:19 am
by wedge1001
mhm. no one that can help me?

so it looks like I have to do a complete reinstall of my current installation?
let's hope, that this won't break the DNS-Cluster or s.th. else :/

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Tue Jan 09, 2018 7:54 am
by mehargags
First Remove PHP5

Code: Select all

apt-get remove --auto-remove php5-fpm
Presuming you are on Debian 8 and you want to install PHP 7.1 FPM

Add repo

Code: Select all

apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update
Install PHP 7.1 FPM

Code: Select all

apt install -y php7.1-fpm
Install Supporting PHP7.1 modules

Code: Select all

apt install -y php7.1-xml php7.1-zip php7.1-mysql php7.1-curl php7.1-mbstring php7.1-json php7.1-gd php7.1-intl php7.1-mcrypt php7.1-xsl php7.1-soap php7.1-common php7.1-readline php7.1-cli php7.1-opcache php7.1-iconv php7.1-sqlite3 php7.1-imap

Code: Select all

ln -s /lib/systemd/system/php7.1-fpm.service /lib/systemd/system/php-fpm.service

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Tue Jan 09, 2018 10:09 am
by wedge1001
thanks. this helped me... i've totally forgotten to remove php 5

So how i got it working:
  • remove the old and install the new php-version as posted by mehargags
  • copy your config files from /etc/php5/fpm/pool.d/ to the new directgory /etc/php/7.1/pool.d/
  • remove /etc/php5 from the filesystem
  • change the config in /usr/local/vesta/conf/vesta.conf

    Code: Select all

    WEB_BACKEND='php7.1-fpm'
  • v-list-sys-services will now show that php7 is running & you can add new configs (yay \o/ )
  • mv /usr/local/vesta/web/edit/server/php5-pfm to /usr/local/vesta/web/edit/server/php7.1-fpm (now edit works)
Thanks for the help! :)

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Tue Jan 09, 2018 12:15 pm
by mehargags
Thank you for the additional documentation @wedge1001 , it sure will help many more poeple.

I also edited my post for an additional step that I missed to write

Code: Select all

ln -s /lib/systemd/system/php7.1-fpm.service /lib/systemd/system/php-fpm.service
this command fixes the error Vesta PHP-FPM failed when creating new domains in the panel as it keeps looking for the symlink that has broken.

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Mon Jan 15, 2018 6:03 pm
by Zaikare
Hi guys, i'm trying upgrade from php7.0-fpm to php7.2-fpm.
I linked service,
copied config, pool (even 7.2/pool.d/ and 7.2/fpm/pool.d),
changed vesta.conf.
My v-list-sys-services shows:

Code: Select all

NAME           STATE    CPU   MEM   UPTIME
----           -----    ---   ---   ------
nginx          running  0     6     567
php7.2-fpm     running  0     13    361
bind9          running  0     102   11192
exim4          running  0     1     361
dovecot        running  0     0     361
clamav-daemon  running  98.3  234   0
spamassassin   running  98.7  3298  11192
postgresql     running  0     9     361
mysql          running  98.7  3298  361
vsftpd         running  0     0     361
cron           running  0.1   169   361
iptables       running  0     0     0
fail2ban       running  0     666   11192
But i still have error "Error: default backend template doesn't exist" while creating web.
Can someone guide me what i'm missing?
Thanks.

UPDATE:
I copied in /usr/local/vesta/data/templates/web from php7.0-fpm to php7.2-fpm, and now i have this error: php-fpm pool doesn't exist

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Tue Jan 16, 2018 5:53 am
by mehargags
A bit of common sense would suggest replacing 7.0 to 7.2 in my commend just above your post.

Code: Select all

ln -s /lib/systemd/system/php7.2-fpm.service /lib/systemd/system/php-fpm.service
Make sure there is only one PHP-FPM pool or else Vesta gets confused

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Tue Jan 16, 2018 6:10 am
by Zaikare
Thank you for your time.

Sorry, forgot to mention, that this also is done:

Code: Select all

lrwxrwxrwx 1 root root   38 Jan 15 18:35 php-fpm.service -> /lib/systemd/system/php7.2-fpm.service
Can you tell me, where i can find PHP-FPM pool?

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Mon Feb 12, 2018 5:30 pm
by mxvin
I discover what to do next, we also need to change some folder name :
  • $inst_dir/vesta/data/templates/web/nginx/php5-fpm
  • $inst_dir/vesta/data/templates/web/php5-fpm/
to php7.x-fpm

If not change that dirs, vesta can't show template on edit.
Zaikare wrote:
Mon Jan 15, 2018 6:03 pm
"I copied in /usr/local/vesta/data/templates/web from php7.0-fpm to php7.2-fpm, and now i have this error: php-fpm pool doesn't exist"
-- and make sure nothing left on /etc another folder named "php", that'll mess func/domain.sh to write/read pool.d folder. --- viewtopic.php?t=13201
;)

Re: How to upgrade from php 5.x to 7.x for nginx + php-fpm

Posted: Wed Mar 14, 2018 4:05 pm
by baoang
I am thinking about moving v5 to v7 or at least v5.6 to install phpBB. The current VestaCP's php-fpm is a bit old.

I found a post from VPS guide
https://vpsguide.net/tutorials/vps-tuto ... 72-centos/

It seems that they only offer essentially two scripts

Code: Select all

sudo yum install yum-utils
and

Code: Select all

sudo yum-config-manager --enable remi-php72
Is this way compatible with the control panel's function? I mean the software was installed indeed but the control panel couldn't recognize the newly installed?

And also, another post said the latest PHP ver is 5.6, but I checked my phpinfo and it tells a diff ver, PHP Version 5.3.3.
https://hasin.me/2015/12/06/upgrading-p ... -vesta-cp/

Well, I didn't install Apache, but only installed nginx and php-fpm. So installation with Apache module can produce PHP v5.6?