A LAMP stack (Linux, Apache, MySQL, PHP) is the classic web server setup for hosting PHP applications including WordPress. This guide covers installation on Ubuntu 22.04.
Install Apache
apt update\napt install apache2 -y\nsystemctl enable apache2\nsystemctl start apache2Test by visiting your VPS IP in a browser β you should see the Apache default page.
Install MySQL
apt install mysql-server -y\nmysql_secure_installationRun mysql_secure_installation to set the root password, remove anonymous users, and disable remote root login.
Install PHP
apt install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-zip -yVerify PHP is working: php -v
Testing the Stack
Create a test PHP file:
echo "<?php phpinfo(); ?>" > /var/www/html/info.phpVisit http://YOUR_VPS_IP/info.php to confirm PHP is working with Apache. Delete this file after testing β it exposes server configuration.