Installing
-
3. Installing LAMP
To install LAMP PHP 8.x on Linux Mint, run the following command for the default setup:
sudo apt install apache2 php8.x mysql-server mysql-client php8.x-mysql
Alternatively, replace MySQL with MariaDB:
Search for the latest PHP 8 release:
apt search php8.
Install with:
sudo apt install apache2 php8.x mariadb-server mariadb-client php8.x-mysql
Verify PHP installation with:
php -v
-
4. Searching PHP 8.x Extensions
Search for available PHP 8.x extensions:
sudo apt search php8.x
Refine results using grep:
sudo apt search php8.x | grep [KEYWORD]
Install useful modules for WordPress:
sudo apt install php8.x-imagick php8.x-curl php8.x-gd php8.x-mbstring php8.x-xml php8.x-xmlrpc php8.x-soap php8.x-intl php8.x-zip
To install multiple packages at once:
sudo apt install php8.x-{curl,xml,imagick,mysql,fpm,bz2}
-
5. Testing LAMP
To test your LAMP web server installation, access the server’s document root:
cd /var/www/html
Create a PHP info file:
sudo nano info.php
For sudo issues, refer to: Enable sudo
Add the following code:<?php phpinfo(); ?>
Ctrl+x to save and exit nano.
Set www-data as the owner of the web server directory:
sudo chown -R www-data:www-data /var/www
Then open your browser at:
http://localhost/info.php
You should see the PHP info page successfully.For creating an Apache 2 Virtual Host, see: GNU+Linux Apache2 VHost
Contents