This will setup the repository for php to be on the latest version

sudo apt-get update && apt-get upgrade
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update

Find all the php components installed

dpkg -l | grep php | tee packages.txt

All the old versions of PHP stay installed on your site. etc/php$ ls
5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3

Install all the php components

sudo apt install php8.2 libapache2-mod-php8.2 php8.2-common php8.2-mysql php8.2-gmp php8.2-curl php8.2-intl php8.2-mbstring php8.2-xmlrpc php8.2-gd php8.2-xml php8.2-cli php8.2-zip php8.2-bcmath php8.2-imagick php8.2-fpm php8.2-bz2 php8.2-mcrypt

Purge the old php components

sudo apt-get purge php8.1 libapache2-mod-php8.1 php8.1-common php8.1-mysql php8.1-gmp php8.1-curl php8.1-intl php8.1-mbstring php8.1-xmlrpc php8.1-gd php8.1-xml php8.1-cli php8.1-zip php8.1-bcmath php8.1-imagick php8.1-fpm php8.1-bz2 php8.1-mcrypt


You need to disable the older versions and enable the newest one

remove old fpm
sudo a2disconf php8.1-fpm

replace fpm
sudo a2enconf php8.2-fpm

sudo systemctl restart apache2

Where to configure php

/etc/php/8.2/fpm/php.ini
/etc/php/8.2/cli/php.ini
/etc/php/8.2/apache2/php.ini

The commands below expand your ability to import pictures into WordPress. I had a web site for my children’s pictures. I wanted the full size pictures. I set the limits above the 2M limit. It also changes the time out size for importing pictures.

upload_max_filesize = 768M
post_max_size =768M
memory_limit = 768M
max_execution_time = 360
mysqli.allow_local_infile = On

test.php

create a file called test.php in the root of your web site. Inside it one line. This will help you with all your php information.

<?php phpinfo(); ?>