Upgrade PHP 8.0 to 8.2 on FreeBSD
Upgrading PHP on FreeBSD takes only a few minutes.
Start off by listing all of the PHP-related packages on your system, including the PHP extensions you have installed.
pkg query -a %n | grep php8
Run the upgrade. Here, I’ve used brace expansion to simplify the command for upgrading the various PHP extensions that all start with php82-
.
sudo pkg install php82 mod_php82 php82-{bcmath,ctype,curl,dom,exif,extensions,fileinfo,filter,gd,iconv,mbstring,mysqli,opcache,pdo,pdo_mysql,pdo_odbc,pdo_sqlite,pecl-imagick,pecl-json_post,pecl-mcrypt,phar,posix,session,simplexml,sodium,sqlite3,tidy,tokenizer,xml,xmlreader,xmlwriter,zip,zlib}
You’ll likely be notified that the packages for PHP 8.0 will be removed as part of the process. That’s helpful. Watch for any notices or errors during the upgrade.
Restart PHP and Apache and then you’re done!
sudo service php-fpm restart
sudo service apache24 restart