sudo apt update
sudo apt install --no-install-recommends php8.1
php -v
sudo apt install php8.1-fpm
sudo a2enconf php8.1-fpm
sudo apt-get install php8.1-PACKAGE_NAME
sudo apt-get install -y php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath
This command will install the following modules:
php8.1-cli
– command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasksphp8.1-common
– documentation, examples, and common modules for PHPphp8.1-mysql
– for working with MySQL databasesphp8.1-zip
– for working with compressed filesphp8.1-gd
– for working with imagesphp8.1-mbstring
– used to manage non-ASCII stringsphp8.1-curl
– lets you make HTTP requests in PHPphp8.1-xml
– for working with XML dataphp8.1-bcmath
– used when working with precision floats
php -m
NOTICE: Not enabling PHP 8.1 FPM by default.
NOTICE: To enable PHP 8.1 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php8.1-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Processing triggers for libapache2-mod-php8.1 (8.1.9-1+ubuntu18.04.1+deb.sury.or g+1) ...
If wordpress website not working
sudo a2disconf php8.1-fpm
sudo a2dismod php7.4
sudo a2enmod php8.0
sudo service apache2 restart