Installing Apache2 With PHP5 And MySQL Support

On Ubuntu 14.04LTS (LAMP)

Installing Apache2,LAMP is short for Linux, Apache, MySQL, PHP. This tutorial indicates how you could install an Apache2 webserver on anUbuntu thirteen.04 server with PHP5 support (mod_php) and MySQL assist.

I do no longer trouble any assure that this will work for you!

1. Installing Apache2,Preliminary Note

In this academic I use the hostname server1.Example.Com with the IP address 192.168.0.One hundred. These settings may fluctuate for you, so you have to replace them wherein suitable.

I’m running all of the steps in this tutorial with root privileges, so make certain you are logged in as root:

sudo su

2. Installing Apache2,Installing MySQL 5

First we install MySQL 5 like this:

apt-get install mysql-server mysql-client

You can be asked to provide a password for the MySQL root person – this password is valid for the person root@localhost in addition to [email protected], so we do not should specify a MySQL root password manually afterward:

New password for the MySQL “root” person: <– yourrootsqlpassword Repeat password for the MySQL “root” consumer: <– yourrootsqlpassword

3. Installing Apache2,Installing Apache2

Apache2 is set up by means of default in ubuntu14.04, If no longer set up then set up it. Apache2 is to be had as an Ubuntu package, consequently we are able to set up it like this:

apt-get install apache2

Now direct your browser to http://192.168.Zero.100, and you must see the Apache2 placeholder page (It works!):

Apache’s default report root is /var/www/html on Ubuntu, and the configuration record is /etc/apache2/apache2.Conf. The configuration device is absolutely documented in /usr/share/doc/apache2/README.Debian.Gz

4. Installing PHP5

We can deploy PHP5 and the Apache PHP5 module as follows:

apt-get install php5 libapache2-mod-php5

We must restart Apache afterwards:

service apache2 restart

5. Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default internet website is /var/www/html. We will now create a small PHP file (info.Personal home page) in that listing and get in touch with it in a browser. The document will display masses of beneficial details about our PHP installation, inclusive of the hooked up PHP version.

vi /var/www/html/info.php

<?php
phpinfo();
?>

Now we call that file in a browser (e.g. http://192.168.0.100/info.php):

As you notice, PHP5 is operating, and it’s running through the Apache 2.Zero Handler, as proven within the Server API line. If you scroll further down, you may see all modules that arealready enabled in PHP5. MySQL is not listed there this means that we don’t have MySQL guide in PHP5 yet.

6. Getting MySQL Support In PHP5

To get MySQL guide in PHP, we can set up the php5-mysql package. It’s a very good idea to put in some different PHP5 modules as well asyou may want them for your programs. You can search for available PHP5 modules like this:

apt-cache search php5

Pick the ones you need and install them like this:

apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Now restart Apache2:

service apache2 restart

Xcache is a loose and open PHP opcode cacher for caching and optimizing PHP intermediate code. It’s similar to different PHP opcode cachers, consisting of eAccelerator and APC. It is strongly recommended to have one of these hooked up to speed up your PHP web page.

Xcache may be mounted as follows:

apt-get install php5-xcache

Now restart Apache:

service apache2 restart

Now reload http://192.168.0.100/data.Personal home page in your browser and scroll right down to the modules section again. You should now find lots of recent modules there, inclusive of the MySQL module:

7. phpMyAdmin

PhpMyAdmin is an internet interface thru which you can manipulate your MySQL databases. It’s an awesome idea to install it:

apt-get install phpmyadmin

You will see the following questions:

Web server to reconfigure routinely: <– apache2 Configure database for phpmyadmin with dbconfig-common? <– No

Afterwards, you could get entry to phpMyAdmin beneath http://192.168.Zero.One hundred/phpmyadmin/: