Upgrading PHP 5.6 to PHP 7.2

This evening I tested the upgrade process from PHP 5.6 to PHP 7.2 since the former is reaching the end of its supported life at the end of this year (2018). The process went fairly smoothly on both my test and production servers and I jotted a few notes on the experience in a Twitter thread:
Thought some people mind find the steps and minor problems I encountered useful for their own upgrades.
 
Would prefer "Replace php56-* with php72-*, don't forget to change Apache/nginx/php-fpm configuration regarding new library location" instead of two dozens of mostly information free messages, but thanks for the pkg/sed one-liner. Also another mention about PHP 5.6 death date is useful, although I would probably newer understand enough that it is really time until... :)
 
Just tried to run the upgrade as per your link which seemed to work but it stopped with an error ...

php72-bz2: Command not found.

I assume this is because I still have all the php56-extensions installed and its trying to upgrade them. If that's the case do I remove all the php56-extensions before running the upgrade ?
 
If that's the case do I remove all the php56-extensions before running the upgrade ?
The lang/php56-extensions is a so-called "meta-port". It doesn't contain anything by itself and simply depends on a list of other ports/packages. So you really only need to remove php56-extensions. The other modules should be "automagically" replaced by their PHP 7.2 counterparts. If you really want to remove the extensions a pkg autoremove would remove everything that's not being depended on by other packages.
 
I tried that SirDice and still got the same error. I'm guessing therefore I will have to use pkg autoremove which I was trying to avoid doing.
 
Keep an eye on the things it will try to remove. If there's anything you want to keep change the package's setting with pkg set -A 0 <packagename>. That will inform autoremove that it wasn't an automatically installed dependency, so it won't try to remove it. See pkg-set(8).
 
Back
Top