I'm running a production server with CentOS 7 and PHP 7.1. I'd LOVE to upgrade to PHP 7.4 but I am nervous about doing this on a production server. I am not the greatest sysadmin in the world, so I have a 3 questions, apologies if they are dumb/obvious to others :-)
I have to upgrade all my PHP extensions (like openssl, pdo_mysql, iconv, json, gd, phar, pdo, libmagic, and a zillion others) at the same time, right? I can't use the existing extensions? So does this mean that I need to make a list of all those extensions, and then source the 7.4 versions to be sure I can upgrade all of them at the same time I upgrade the core PHP files? (Or is there some automated way to upgrade PHP and all existing extensions? Doing it "by hand" feels like a lot of work, and a lot of potential to screw up something. I'm just wondering if there's a more elegant solution that I'm overlooking.)
This is all on a production server (where PHP 7.1 runs as php-fpm under nginx). AFAIK the only option I have for upgrading is to take my site offline for maintenance, and then try to do the upgrade and hope nothing goes terribly wrong. Is that right? If so, how can I minimize the impact? I'd much prefer to get PHP 7.4 running perfectly alongside the existing 7.1 and then flip over to 7.4 on one quick switch, but can't figure out how. (EDIT: I should add that I am not using Docker or any other kind of virtualization. When I do
whereis php
I get:php: /usr/bin/php /usr/lib64/php /etc/php.d /etc/php.ini /usr/share/php /usr/share/man/man1/php.1.gz
)And then the best way to upgrade is... to use pre-built images that someone offers, like Remi's RPM Repo?
Thanks.
Yes, there is a dependency on internal API/ABI
This is possible with Software Collections which allows parallel installation of various versions.
Especially with FPM it is quite easy to run various instances (1 per version), and select used instance for each virtual host / application / directory.
You can then switch sites one by one.
You can read: PHP Configuration Tips
Of course, I will recommend to test each application on a dedicated test environment, before running the upgrade on the production one.
Of course, I answer yes ;) I think it is better to use standard binaries, used on thousands of servers rather than building from sources. Also, having development tools installed on a production server is a very bad practice (security point of view)
For a proper installation, see the Remi's Configuration Wizard instructions.
have to upgrade all my PHP extensions (like openssl, pdo_mysql, iconv, json, etc) at the same time, right? I can't use the existing extensions? yes
AFAIK the only option I have for upgrading is to take my site offline for maintenance, and then try to do the upgrade and hope nothing goes terribly wrong. Is that right? No, you can upgrade without making offline, you can install PHP 7.4 without uninstall PHP 7.1. So just install PHP 7.4 first then switch Nginx config to PHP 7.4. But you need to restart the Nginx (maybe take 1-5 seconds).