Topic: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Hello

I saw the helpful Wizard on Remi website, but it doesn't cover what I'd like: to upgrade PHP 5.6.19 to 7.3 latest -- *without* changing current paths. In essence I'd like to overwrite the php 5.6.19 to php 7.3.

From my understanding, as Remi suggests, paths like /etc/php-fpm/*.conf will need to change to /etc/php73-fpm/*.conf, etc. Which is cumbersome because that means I'll have to change paths in various places across Nginx conf, across crontabs for backup, etc.

I find there are important settings in these places:

1. /etc/php-fpm.d/www.conf
2. /etc/php.ini
3. /etc/php-fpm.conf
4. /etc/nginx/common.conf
5. /etc/nginx/fastcgi.conf

And of course the Nginx.conf (the main Ngnix config file) has calls to PHP-FPM accordingly. They include the #4 file above, common.conf, which in turn includes the `fastcgi.conf`.

Instructions on external websites, such as Cyberciti do not take into account Nginx and PHP-FPM specifics especially in terms of old PHP 5.6.19 already existing. I am not allowed to post too many links as this is my first posting here, but links are in the Server Fault thread too, where someone recommended to visit this website: https://serverfault.com/questions/95271 … 825_952713

All these instructions anyway speak of "php72" (or, therefore, php73) which I am afraid will change all the paths, and I'll have to update all paths to new php links everywhere. This is also not future proof. If PHP 7.4 is launched, will it then need "php74" folders everywhere?

Could you please advise how best to do this so I seamless upgrade the old PHP with the latest, with all the usual paths as above working and basically "overwrite" PHP 5.6?

Thanks!

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

as i Said, following the wizard instruction, for "single version", package have the same name (php-*) and use the same path.

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

path in /opt are only used for Software Collections which are designed  to allow multiple versions installed  simultaneously

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Thank you for this. I think my 5.6.19 was installed via Remi too. So what specifically is the set of yum commands to upgrade to pho 7.3 and not end up with folders with specific version numbers like php73-*?

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Again, simply follow the wizard instructions...

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Thank you, but they're not really focused on an Nginx + Php-fpm install and may screw things up? The wizard assumes a lot of things.

Example:

Command to install additional packages:
   yum install php-xxx

Which are those packages?

Also, when I run "yum update" after enabling the php73 thing, I get these errors.

--> Running transaction check
---> Package libXaw.x86_64 0:1.0.13-4.el7 will be installed
---> Package libXmu.x86_64 0:1.1.2-2.el7 will be installed
---> Package php56w-common.x86_64 0:5.6.19-1.w7 will be obsoleted
--> Processing Dependency: php56w-common(x86-64) = 5.6.19-1.w7 for package: php56w-mcrypt-5.6.19-1.w7.x86_64
--> Finished Dependency Resolution
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-327.10.1.el7 will be erased
---> Package php56w-common.x86_64 0:5.6.19-1.w7 will be obsoleted
--> Processing Dependency: php56w-common(x86-64) = 5.6.19-1.w7 for package: php56w-mcrypt-5.6.19-1.w7.x86_64
--> Finished Dependency Resolution
Error: Package: php56w-mcrypt-5.6.19-1.w7.x86_64 (@webtatic)
           Requires: php56w-common(x86-64) = 5.6.19-1.w7
           Removing: php56w-common-5.6.19-1.w7.x86_64 (@webtatic)
               php56w-common(x86-64) = 5.6.19-1.w7
           Obsoleted By: php-common-7.3.2-1.el7.remi.x86_64 (remi-php73)
               Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Perhaps I had installed using some "webtatic" repo in the past? What can I do now?

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

The upgrade fails because of the mcrypt extension which is deprecated and removed from PHP.

This failure IS EXPECTED

READ: https://blog.remirepo.net/post/2015/07/ … php-mcrypt

If you don't need it, remove it and you will be able to upgrade
If you really need it, you CANNOT upgrade to 7.3
(you can update to 7.2 thanks to the php-pecl-mcrypt package)

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Sorry, I was wrong. The php-pecl-mcrypt package is also available for 7.3

so remove php56w-mcrypt before the update
and install php-pecl-mcrypt after

P.S. but still a very bad idea to rely on this dead cow

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Ok I removed it. Now how to be sure which packages I should install with “yum install php-xxx”? Is there a way to find out currently installed modules and easily find replace the php73 equivalents? Thanks so much for all your help. I am hoping this will essentially upgrade the current paths to php73, and I don’t have to go updating all the paths?

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

If it helps, "php --modules" shows me this list. How can I easily install all of these? I cannot find them using "yum list php-*". Thanks for any help!


[PHP Modules]
apc
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
geoip
gettext
gmp
hash
iconv
igbinary
imagick
json
libxml
mbstring
memcache
memcached
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Hopefully someone can help, but this part of the wizard is incorrect:

Command to enable the repository:
    yum-config-manager --enable remi-php73

If the priorities plugin is enabled, ensure remi-php73 have higher priority (a lower value) than base and updates

Command to upgrade (the repository only provides PHP):
    yum update

Command to install additional packages:
    yum install php-xxx

The "yum update" did not upgrade the core PHP either. It's still 5.6.19. Anyway, how should I ensure that both php, and all the rest of it including php-fpm etc is all upgraded to PHP 7.3? Thanks.

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Just sharing some more info so someone can offer guidance.

I noticed something in the wizard after the 'yum update' command:

If the priorities plugin is enabled, ensure remi-php73 have higher priority (a lower value) than base and updates

This is what I see in /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
..

The file /etc/yum/pluginconf.d/priorities.conf is empty.

Any ideas based on this? The "yum update" does not update php from 5.6.19.

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

1/ compare the "php --modules" output before and after the upgrade.

If xxx extension is missing, simply "yum install php-xxx" (as explained by the wizard)

> The "yum update" did not upgrade the core PHP either. It's still 5.6.19.

So disable the priority plugin, or configure it properly, as you want to replace base packages (as explained by the Wizard)

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

14 (edited by morespinach 2019-02-08 06:35:24)

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

What’s the correct way to configure the priority plugin? Any pointers would be appreciated. Google turned up the kinds of things that don’t fill me with confidence. The wizard just mentions it, doesn’t “explain” it.  Many thanks.

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

> What’s the correct way to configure the priority plugin?

Set priority for each repo... with proper value

Or, simple way

yum remove yum-plugin-priorities

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

When I do “yum remove yum-plugin-priorities” it tells me no packages marked for deletion.

So it’s not the priorities stuff. What else could be wrong?

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Not enough information, need the full yum ouput.

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

And try with   --noplugins  option

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

What should I try with —noplugins? The yum update?

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

yes, yum update --noplugins

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

21 (edited by morespinach 2019-02-08 13:30:45)

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

OK, I ran that. Big problem.

The yum update --noplugins did run, but it showed errors like these:

Warning:  Module 'wddx' already loaded in Unknown on line 0
PHP Warning:  Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning:  Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning:  Module 'xsl' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib$
  Cleanup    : kernel-tools-3.10.0-957.1.3.el   164/191   Cleanup    : libgudev1-219-62.el7_6.2.x86_6   165/191   $
PHP Warning:  Module 'calendar' already loaded in Unknown on line 0
PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
PHP Warning:  Module 'curl' already loaded in Unknown on line 0
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'exif' already loaded in Unknown on line 0
PHP Warning:  Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning:  Module 'ftp' already loaded in Unknown on line 0
PHP Warning:  Module 'gettext' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gmp.so' (tried: /usr/lib64/php/modules/gmp.so (/usr/lib$

php --version does show 7.3. But I think php-fpm is not properly installed.

Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.

Doing that systemctl shows:

# systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2019-02-08 08:20:53 EST; 7min ago
  Process: 3501 ExecStart=/usr/sbin/php-fpm --nodaemonize (code=exited, status=78)
 Main PID: 3501 (code=exited, status=78)

Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com systemd[1]: Starting The PHP FastCGI Process Manager...
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com php-fpm[3501]: [08-Feb-2019 08:20:53] ERROR: [/etc/php-fpm.d/www.conf:32] value is NULL for a ZEND_INI_PARSER_ENTRY
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com php-fpm[3501]: [08-Feb-2019 08:20:53] ERROR: Unable to include /etc/php-fpm.d/www.conf from /etc/php-fpm.conf at line 32
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com php-fpm[3501]: [08-Feb-2019 08:20:53] ERROR: failed to load configuration file '/etc/php-fpm.conf'
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com php-fpm[3501]: [08-Feb-2019 08:20:53] ERROR: FPM initialization failed
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com systemd[1]: Failed to start The PHP FastCGI Process Manager.
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com systemd[1]: Unit php-fpm.service entered failed state.
Feb 08 08:20:53 SUBDOMAIN.DOMAIN.com systemd[1]: php-fpm.service failed.

What now? All my websites are down sad

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

> PHP Warning:  PHP Startup: Unable to load dynamic library  ...
Such message during the update is expected (during the update not everything is consistent)
Should not happends after the update

php -v ?
php -m ?
fpm error log ?

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Also paste /etc/php-fpm.d/www.conf (to check line 32)

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

Explanation: on update configuration files are preserved. Which is usually expected.

But on big update (e.g. 5.6 => 7.3) some change may be required, so comparing  with .rpmnew installed files is usually a good practice

Desktop: Fedora 29 x86_64 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 28 x86_64 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 6.10 x86_64 with EPEL, remi, remi-php72 and remi-php72-test

Re: Upgrading php 5.6.x to 7.3 on CentOS 7 with Nginx and php-fpm

OK, I fixed it. The /etc/php-fpm.d/www.conf file had some comments that started with "#". Apparently PHP 7.3 is finicky about them. Changed them to ";" and it's fine now. Thanks for all the help.

What have I missed with the "yum update --noplugins"? Do I need some plugins?