How to Install Apache, MySQL and PHP on Ubuntu (Without XAMPP or LAMP)

SINCE 2013

XpertLab Technologies. Website Designing Company in Junagadh
Future Of Virtual Reality (VR)
27th August 2025
Authentic
The Gentle Art of Authentic Confidence in Leaders
30th August 2025
XpertLab Technologies. Website Designing Company in Junagadh
Future Of Virtual Reality (VR)
27th August 2025
Authentic
The Gentle Art of Authentic Confidence in Leaders
30th August 2025
Show all

How to Install Apache, MySQL and PHP on Ubuntu (Without XAMPP or LAMP)

On Ubuntu, you don’t need third-party bundles like XAMPP, WAMP, or LAMPP to set up a development environment. Instead, you can install Apache, MySQL, and PHP manually using Ubuntu’s package manager. This method gives you a clean and flexible setup where each component is installed and configured natively in the system. By doing so, you have better control over versions, security updates, and configuration settings, making it suitable not only for development but also for production environments.

Install Apache

To begin, you first install Apache, which is the web server responsible for serving your website’s files and handling client requests.

sudo apt update

sudo apt install apache2

Once installed, you can verify Apache is running by entering http://localhost in your browser, which should display the default Apache welcome page.

Install MySQL

Next, install MySQL, which is the database management system used to store and manage your application data.

sudo apt install mysql-server

After installation, it’s recommended to secure the database using the command

sudo mysql_secure_installation

After setting up MySQL, you can install phpMyAdmin to easily manage databases through a web interface.

sudo apt install phpmyadmin

During installation, choose Apache2 as the web server and configure it with your MySQL setup. Once installed, phpMyAdmin can be accessed by visiting http://localhost/phpmyadmin in your browser, where you can log in with your MySQL credentials to manage databases visually.

Install PHP

After setting up MySQL, install PHP, the server-side scripting language required to run dynamic applications. You can install a specific version of PHP with sudo apt install php libapache2-mod-php php-mysql. If you need multiple PHP versions (e.g., PHP 7.4, 8.1, 8.2), you can install them side by side:

sudo apt install php7.4 php7.4-mysql libapache2-mod-php7.4

sudo apt install php8.1 php8.1-mysql libapache2-mod-php8.1

sudo apt install php8.2 php8.2-mysql libapache2-mod-php8.2

To switch between versions, disable the current module and enable the desired one, then restart Apache:

sudo a2dismod php8.1
sudo a2enmod php7.4
sudo systemctl restart apache2

similar blog Click

For more information Contact XpertLab