Update PHP

Update PHP 8.2

Run the following commands to update the PHP 8.2 packages currently installed on your system:
$ sudo apt update
$ dpkg -l | awk '$1 == "ii" && $2 ~ /^php8[.]2/ {print $2}' | xargs -r sudo apt install -y --only-upgrade --no-remove
This command updates only the PHP 8.2 packages that are already installed and does not remove existing packages.
 
Step 2

Verify the Update

After the update completes, check the installed PHP version:
$ php -v
The output should report PHP 8.2.35 or a newer version