Quick answer: Install a LAMP stack on AlmaLinux, Rocky, or CentOS with dnf: install and start Apache (httpd), install and secure MariaDB, then install PHP and restart httpd. Open HTTP and HTTPS in the firewall, verify PHP with a temporary info.php, and set correct ownership and SELinux context on the web root.
A LAMP stack - Linux, Apache, MySQL/MariaDB, and PHP - is the classic web server foundation and the default for many PHP applications. These steps set it up on AlmaLinux, Rocky, or CentOS using dnf.
dnf update -y
dnf install httpd -y systemctl enable --now httpd
Open the web ports in the firewall, then load your server IP to see the Apache test page:
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload
dnf install mariadb-server -y systemctl enable --now mariadb mysql_secure_installation
Set the root password and accept the security prompts to remove anonymous users and the test database.
dnf install php php-mysqlnd php-fpm -y systemctl restart httpd
For a newer PHP version than the base repositories provide, enable an appropriate PHP module stream before installing.
Create /var/www/html/info.php with <?php phpinfo();, open it in a browser to confirm PHP renders, then delete it so server details are not exposed.
Ensure your site files under /var/www/html are owned appropriately (commonly the apache user) so Apache can read them and your deploy user can write them. If pages return a 403, incorrect ownership or SELinux context is the usual cause; set the correct SELinux context for web content rather than disabling SELinux.
Pages return 403 - why?
Usually incorrect ownership or SELinux context on the web root; set the proper SELinux context rather than disabling SELinux.
How do I get a newer PHP version?
Enable the appropriate PHP module stream before installing.
On a SoftSys managed Linux VPS we can provision AlmaLinux with your LAMP stack ready to go, including SELinux configured correctly, so you avoid the permission pitfalls that slow down a manual build.