This combination of the operating system (Linux) with the web server (Apache), database server (MariaDB/MySQL), and server-side scripting language (PHP) is known as the LAMP stack.
sudo mysql_secure_installation
Step 4: Verify Installation
Contents
http://IP_address/
Step 2: Installing PHP Using Remi Repository
This how-to guide explains how to install the latest version of Apache, MySQL (or MariaDB), and PHP, along with the required PHP modules, on RHEL-based distributions such as Fedora, Rocky, and Alma Linux.
sudo echo “<?php phpinfo(); ?>” > /var/www/html/info.php
sudo yum install mysql-server
Installing MariaDB in Linux
sudo yum install httpd
Congratulations! You have successfully installed Apache, MySQL/MariaDB, and PHP on your RHEL server. With this LAMP stack set up, you are ready to host and deploy dynamic websites and web applications.
sudo yum install php-mysqlnd php-pdo php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear
http://your_server_ip/info.php
sudo firewall-cmd –zone=public –permanent –add-service=http
sudo firewall-cmd –zone=public –permanent –add-service=https
sudo firewall-cmd –reload
Before starting the installation process of the web server, ensure that your server is up-to-date by running the following yum or dnf commands.
sudo systemctl start mysqld # For MySQL
sudo systemctl enable mysqld
sudo systemctl status mysqld
sudo systemctl start mariadb # For MariaDB
sudo systemctl enable mariadb
sudo systemctl status mariadb
sudo systemctl restart httpd
Step 3: Installing MySQL or MariaDB in Linux
sudo yum install mariadb-server
sudo yum install php
sudo systemctl restart httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
sudo yum update
Or
sudo dnf update
sudo yum install epel-release
Now you can install Apache, which is a widely used open-source web server software that serves web content over the HTTP protocol.