Upgrade PHP 8.0 to 8.2

php update has been described many times in this forum! The search function would have helped you.

You have a real mess installed.

You should first:

Remove unneeded php packages:

sudo apt-get remove --purge php7.4* php8.1*

Now install all php packages in 8.2 which you had in php 8.0:

for package in $(echo `dpkg -l | awk '/^ii.*php8.0/ {print $2}' | sed 's/php8.0/php8.2/g'`); do sudo apt-get -y install $package; done

That is the installation part. Now you have to adapt your php.ini settings from 8.0 to 8.2

You can use the script php-updater for that. It reads step by step every setting you made in 8.0 and asks if you want to port that setting to your new (8.2) ini file. It can also do the update part but that is not necessary as I explained that steps in the previous paragraph:

sudo wget -qO /usr/local/bin/php-updater https://global-social.net/script/php-updater
sudo chmod +x /usr/local/bin/php-updater
php-updater 8.0 8.2
More about the php-updater script: Php-updater - a script to upgrade php in a safe way

Hope that helps,
much luck!

3 Likes