Search blog

Monday, January 5, 2015

Install LAMP Stack in Ubuntu 14.04 with a Single Command & PHP Modules

You can install LAMP stack in Ubuntu 14.04 with a single command. Here's the command:

 $ sudo apt-get install apache2 php5 php5-mysql mysql-client mysql-server  

During the installation process you will be asked to enter PASSWORD for your MySQL 'root' user account. This is optional.

Once the installation is successful you can crosscheck by creating a info.php file under 'var/www/htm/info.php' containing the code below:

 <?php phpinfo(); ?>  

Now open a browser and view the result of the above PHP file. If you are using a localhost you can enter the forllowing URL in your browser:

 http://localhost/info.php  

Install PHP Modules

If you would like to add some additional modules to enhance your PHP read below:

To see the available options for PHP modules and libraries, you can type this into your system:

 apt-cache search php5-  

The results are all optional components that you can install. It will give you a short description for each:

 php5-cgi - server-side, HTML-embedded scripting language (CGI binary)  
 php5-cli - command-line interpreter for the php5 scripting language  
 php5-common - Common files for packages built from the php5 source  
 php5-curl - CURL module for php5  
 php5-dbg - Debug symbols for PHP5  
 php5-dev - Files for PHP5 module development  
 php5-gd - GD module for php5  
 . . .  

To get more information about what each module does, you can either search the internet, or you can look at the long description in the package by typing:

 apt-cache show package_name  

If, after researching, you decide you would like to install a package, you can do so by using the apt-get install command like we have been doing for our other software.

If we decided that php5-cli is something that we need, we could type:

 sudo apt-get install php5-cli  

If you want to install more than one module, you can do that by listing each one, separated by a space, following the apt-get install command, like this:

 sudo apt-get install php5-cgi php5-cli php5-curl php5-mysql php5-odbc php5-memcache php5-memcached php5-oauth  

No comments:

Post a Comment

Thank you for your Feedback!
www.evagabond.me

Top 5 Posts (Weekly)