LAMP means Linux, Apache, MySQL, and PHP is an open source software stack. Therefore, you can use LAMP to configure the web server and host the web content. In this tutorial, we have explained to you a step by step method of how to install Linux, Apache, MySQL, and PHP on Ubuntu. Linux part is taken care of by Ubuntu; you only have to install the rest.
Follow the given steps to setup LAMP and install Apache, MySQL, and PHP on Ubuntu 14.04.
1: Install Apache
Apache is the world’s popular open-source web server software. Therefore, to install Apache on Ubuntu, open the terminal and type the following commands.
sudo apt-get update sudo apt-get install apache2
2: Install MySQL
MySQL is an open-source relational database management system. So, to install MySQL on Ubuntu, open the terminal and type the following commands.
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
SEE ALSO: How to Create Loader Animation with CSS
3: Install PHP
PHP is an open-source server-side scripting language. To install PHP on Ubuntu, open the terminal and type the following commands.
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Well done! You did the installation of a LAMP stack on Ubuntu.
4: Restart Server
Apache will automatically restart after the installation of both PHP and MySQL. However, you can restart the Apache server manually by executing the following commands.
sudo service apache2 restart
5: Check Apache
Open your browser and run this URL – http://localhost/. You’ll see a message saying, “It works!”.Step 6:
6: Check PHP
Now check whether PHP is working.
Create a new PHP file (info.php) in the /var/www/ directory and place the following code.
<?php phpinfo(); ?>
Open the http://localhost/info.php URL on the browser. If it displays the PHP info on the screen, PHP is working correctly.
Also, read our previous blog- Display Loading Image While Page Loads using jQuery and CSS