Solved Problem after upgrading to php 7.4.4

I'm running FreeBSD 11.2r15 inside a FreeNAS jail with a FAMP stack. Apache 2.4.43, MySQL 5.7.29_1, PHP 7.4.4. I am learning as I go along but have been maintaining and updating this server for a few years.

I can't seem to find a solution to this, so if I missed it, sorry. I really did search.

Last night I uninstalled PHP 7.3.16 and installed PHP 7.4.4 since pkg didn't give me an upgrade path

Code:
pkg delete php73-7.3.16
pkg install php74-7.4.4

After then reinstalling all of the extensions that the uninstall removed (using pkg) I restarted Apache 2.4

Now, my PHP applications are giving me an error

Code:
ERROR - 2020-04-12 11:48:20 --> Severity: error --> Exception: Call to undefined function mysqli_init() /usr/local/www/public_html/pos_clcdesq/vendor/codeigniter/framework/system/database/drivers/mysqli/mysqli_driver.php 135
ERROR - 2020-04-12 11:48:20 --> Severity: Core Warning --> PHP Startup: Unable to load dynamic library 'imap.so' (tried: /usr/local/lib/php/20180731/imap.so (Cannot open "/usr/local/lib/php/20180731/imap.so"), /usr/local/lib/php/20180731/imap.so.so (Cannot open "/usr/local/lib/php/20180731/imap.so.so")) Unknown 0

when I checked that path, it doesn't exist. The path that does exist. The path that does exist is /usr/local/lib/php/20190902/ and the imap.so is properly located in that. I'm guessing all I need to do is properly change the path. The problem is that I cannot find that path listed anywhere to change it.

/usr/local/etc/php.conf reads
Code:
PHP_VER=74
PHP_VERSION=7.4.4
PHP_SAPI=cli cgi fpm embed
PHP_EXT_INC=hash pcre spl
PHP_EXT_DIR=20190902

So I would have thought that it would pick it up, but I'm not sure where to look. Can anyone help?
 
I was able to resolve the issue. I'll post it here in case someone else runs into the same problem.

I had assumed that since pkg deleted a bunch of packages associated with php73-7.3.16, it had deleted all of them. I happened to run
Code:
pkg version
and noticed that it had not removed mod_php73-7.3.16 so I uninstalled it and installed mod_php74-7.4.4. After restarting Apache everything works again! Moral of the story kids is make sure that pkg actually uninstalls all dependencies when you remove a package.
 
Last edited:
FWIW, running # pkg autoremove -n from time to time will give you an idea of which packages pkg considers unneeded. You might not agree for all of them.
Note: do not blindly run # pkg autoremove and confirm that you want all packages it lists removed!
 
You may have had some PHP extensions installed, f.e. php73-mysqli and php73-imap. By uninstalling php73 I suggest both to be uninstalled, too… And installing php74 will not automatically reinstall them. Also don't forget to restart your Apache ("service apache24 restart").

In my opinion it makes sense to save a package list saved to a file ("pkg info > packages.txt"), so that you can check later in such cases what was installed…
 
It did automatically uninstall those when I uninstalled php73, but yes I had to manually reinstall them. The only one I couldn't reinstall was ioncube because apparently there isn't yet a build for 7.4.4. hash is also now built in so I didn't need to reinstall it in 7.4.4
 
mod_php has been an off-to-the-side thing when I've being doing PHP upgrades - it definitely doesn't count as a PHP entity. So I usually have to keep an eye on it when doing any PHP changes.

Maybe because the rest of PHP is lang/php but mod_php is www/mod_php? So mod_php is treated as a web "thing" rather than a language "thing"?
 
Back
Top