Installing Apache-PHP-Mysql via bash file

 

 

To install Apache and PHP latest version in Bash scripting on Ubuntu, you can use the following commands:#!/bin/bash
sudo apt update
sudo apt install apache2
sudo apt install php libapache2-mod-php php-mysql


Here, we first update the Ubuntu package list using sudo apt update command. Then, we install Apache web server using sudo apt install apache2 command.

After that, we install PHP and related modules using sudo apt install php libapache2-mod-php php-mysql command. This will install the latest version of PHP and also the required module to integrate it with Apache web server.

You can save this code in a file with a .sh extension, for example install_apache_php.sh, and then make it executable using the following command:

chmod +x install_apache_php.sh


Once the script is executable, you can run it using the following command:


./install_apache_php.sh


This will execute the script and install Apache and PHP latest version on your Ubuntu system.