Ubuntu: Installing apache and Php

18 Mar

Its very easy to install apache and php on Ubuntu.

After installing Ubuntu you will need to do the following.

Go to Application/Accessories/Terminal

And write

$ sudo apt-get install apache2

A process will start when you will give correct password and apache will be installed in few minutes depending on your internet speed.

Next, for installing Php, write

$ sudo apt-get install php5

This will install Php5 for you.

If you want to create php extension you will need to install phpize.

This will need some extra steps.

Like, you will first need to install pear as

$ sudo apt-get install php-pear

This will prompt for y. enter y and press enter.

Now use the following code for installing phpize.

$ sudo apt-get install php5-dev

You may have heard about PECL extension. To install these extension you will need the following steps.

Before taking these step you will need to go through all the steps discussed above.

  1. install apache
  2. install php
  3. install pear
  4. install phpize

After installing all the above you will need to install another package named libcurl3-openssl-dev. To install this package you will need to run the following in terminal.

$ sudo apt-get install libcurl3-openssl-dev

And now install PECL as

$ sudo pecl install pecl_http

After running this command and accept default options PECL extension will be installed.

However to use this you will need to add a line to php.ini file. Do the following for this purpose

$ sudo nano /etc/php5/apache2/php.ini

And add the following line of code

“extension = http.so”

And restart your services as

$ sudo /etc/init.d/apache2 restart

$ sudo /etc/init.d/httpd restart

That’s it you have now installed apache, php, phpize and PECL extension.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: