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.
# 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
During MySQL server and client installation you will be prompted for the
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.
PHP 5, Apache 2 configuration verification
/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
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
You will see the MySQL server status.