How to install PHP8.1 on Ubuntu 22.04


Step 1: Install PHP
apt-get install php8.1 -y
apt-get install php8.1-fpm -y
apt-get install php8.1-dev -y

Step 2: Install some extensions:

apt install php8.1-gd
apt install php8.1-curl php8.1-mbstring php8.1-xml php8.1-mysql php8.1-odbc php8.1-intl php8.1-http php8.1-gmp
apt install php8.1-zip php8.1-tidy php8.1-bcmath

Step 3:
systemctl enable php8.1-fpm
systemctl start php8.1-fpm

Step 4: edit file /etc/php/8.1/fpm/pool.d/www.conf

change line:
listen = /run/php/php8.1-fpm.sock

to
listen = 127.0.0.1:9000

Step 5: Restart php-fpm

systemctl restart php8.1-fpm
Done!

Leave a Reply