Install PHP 8.2 on Ubuntu 22.04 with Nginx
sudo apt update && sudo apt upgrade -y
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.2-fpm
php-fpm8.2 -v
sudo apt install php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-imagick php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-opcache php8.2-soap php8.2-zip php8.2-redis php8.2-intl -y
sudo nano /etc/php/8.2/fpm/php.ini
Hit F6 for search inside the editor and update the following values for better performance.
upload_max_filesize = 32M
post_max_size = 48M
memory_limit = 256M
max_execution_time = 600
max_input_vars = 3000
max_input_time = 1000
Once you have modified your PHP settings you need to restart your Apache for the changes to take effect.
For users with Nginx to who use PHP-FPM, you need to restart PHP-FPM.
sudo service php8.2-fpm restart
Configure PHP 8.2 FPM Pools
PHP-FPM allows you to configure the user
and group
that the service will run under. You can modify these with these commands.
sudo nano /etc/php/8.2/fpm/pool.d/www.conf
If you want to change the username name you can change the following lines by replacing the www-data with your username
.
user = username
group = username
listen.owner = username
listen.group = username
Hit CTRL+X
and Y
to save the configuration and check if the configuration is correct and restart PHP.
Restart PHP 8.2 FPM
Once you have updated your PHP FPM settings you need to restart it to apply the changes.
sudo php-fpm8.2 -t
sudo service php8.2-fpm restart
Now you are having PHP 8.2 Installed and configured.
Permission Add nginx to group
sudo usermod -a -G www-data nginx
this article is from Cloudbooklet .check it out from there