Install php manually with tar file (Ubuntu)

Posted on  by Fuad Abdul Zabar

Install php manually

1. Download the latest source code from PHP Download page. Current stable release is php-5.5.9.tar.bz2. Move the source to /usr/local/src and extract is as shown below.

cd /usr/local/src
bzip2 -d php-5.5.9.tar.bz2

tar xvf php-5.5.9.tar

cd php- php-5.5.9

2. Again, this step is semi optional as it deals with configuring php before you install it. So, if you want to customize the installation, or see how you can customize it:

./configure –help

3. The next commands actually install PHP, with the default apache install location of /usr/local/apache2:

./configure –with-apxs2=/usr/local/apache2/bin/apxs
make install
cp php.ini-dist /usr/local/lib/php.ini

4. Open the file /usr/local/apache2/conf/httpd.conf and add the following text:

<FilesMatch “\.ph(p[2-6]?|tml)$”>
SetHandler application/x-httpd-php

Then while in that file make sure it has a line that says LoadModule php5_module modules/

5. Now you will want to restart apache and verify that php is installed and woking correctly:

/usr/local/bin/apache2/apachectl restart

No make a file called test.php in your /usr/local/apache2/htdocs folder with the following line in it:

<?php phpinfo(); ?>

Now point your favorite internet browser at http://local-host/test.php and it should tell you all about your working php installation.