How to Install LAMP Stack on Linux - Ubuntu 17.04


What is LAMP?

    LAMP stands for Linux with Apache, Mysql and PHP. In this article we are going to see how to install a LAMP stack in Debian based machines Ubuntu-17.04. We are going to install all these packages through source installation which allows us to install required versions.

Installing Apache:

    On my previous articles i showed how to run a customized apache through source installation. Click here if you miss the article for installing Apache.

Installing Mysql:

    On Ubuntu machine we are going to install the default mysql through apt.






Installing PHP:

    As already told we are configuring applications through source installations.


Downloading the source package,

    Download the package from PHP official site. Click here to go to the downloads page. This page has the latest stable version for PHP. 


For older versions Click here.



Extract the file,



Follow the steps for source installation,



Dependencies and solutions:

Before configuring the PHP, it should met some dependencies to be installed inorder to avoid config errors,




Enter the below configure command after installing all the dependencies,



The above command configures PHP with the given apache server path with necessary modules to run a LAMP stack.


For more modules you can refer the below the command
 


Note: --with-mysqli should be used instead of --with-mysql for PHP-7 and higher versions.

Run make and make install to complete the installation,



 


The PHP module will be enabled after the installation, but still we need to edit the httpd.conf file to run a PHP server.

Changes to be done in httpd.conf:

Your dir_module should allow index.php files,


Add the below lines inside mime_module,



Finally add the filesmatch declaration at the end of the httpd.conf,



Now you have configured PHP with your Apache server.

To test the LAMP stack create a PHP info file in the Document root,



Enter the below contents in the file,



Start the apache process after testing the configuration,




Now enter the IP address or 127.0.0.1(If you installed in your local system) on the browser like,

IP_address/info.php or 127.0.0.1/info.php

If your installation is successful you will be able to view the PHP informations on your browser.

 

Feel free to ask if you have any questions on the comment box.

Comments

Popular Posts on this blog

Creating and Running Virtual Machines in LINUX - KVM - Cli Mode

Apache Webserver - Installation from source (tar.gz and tar.bz2)

Replacing Commands for Linux Files - Using Perl and Sed

How to install Docker on Ubuntu-17.04

Setting up a Mail server using Roundcube - Part-3 - Centos 7

Blog Top Sites

Blog Log