Apache, PHP, MySQL installation on Ubuntu

Today we are going to setup an environment where you will be able to host PHP/MySQL applications. This environment consists of the Apache2 HTTP Server with PHP support and MySQL database. This installation is performed on the Ubuntu Server.

Installation

# Install Apache 2 HTTP Server
sudo apt-get install apache2

# Install PHP5
sudo apt-get install php5

# Install latest MySQL Server and client programs as well
sudo apt-get install mysql-server

# Install PHP5 module that allows to connect to MySQL database
sudo apt-get install php5-mysql

Configuration

During MySQL server and client installation you will be prompted for the root password.

ITCuties - MySQL installation - set root password

ITCuties – MySQL installation – set root password

Verification

Apache 2 installation verification

To verify if the apache is installed correctly navigate to http://machine-ip-or-hostname. You should see the β€œIt works!” page.

ITCuties - Apache2 - It works page

ITCuties – Apache2 – It works page

PHP 5, Apache 2 configuration verification

Navigate to /var/www directory. Create a phpinfo.php file with the given contents.

<?php
phpinfo();
?>

Navigate to this file in the browser – http://machine-ip-or-hostname/phpinfo.php. You should see the following page being displayed

ITCuties - PHP, Apache installation verification

ITCuties – PHP, Apache installation verification

MySQL installation verification

Login to your MySQL database using the password that you have provided during the installation process.

mysql -u root -p

When you log in check whether everything is ok with the installation, enter status command

mysql> status;

You will see the MySQL server status.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>