Howto- Install the Last php from source in Centos & Fedora

erlang and dependencies

Question: How to install the latest PHP version from source in CentOS and Fedora?

Answer:

Please follow The  steps bellow  to install the  latest  php release.  this installation is done on Centos 6.2 .

1-Download  and  install Development tools  from  yum :

yum groupinstall "Development tools"

2-Install libxml2-dev needed for  the  configs:

yum install libxml2-devel

3-Check My Installed php release

# php -v
output
PHP 5.3.3 (cli) (built: Feb 2 2012 23:47:49)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

4-Download the last tarball php file from php Servers

my example  is php-5.4.0.tar.gz

tar -zxvf   php-5.4.0.tar.gz
cd php-5.4.0
./Configure
#########################################################
make
Output
................
clicommand.inc
 directorygraphiterator.inc
 phar.inc
Build complete.
 Don't forget to run 'make test'.

##############################################

make install
Output
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing PHP CGI binary: /usr/local/bin/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
 ###########################################################

5-You may want to add: /usr/local/lib/php to your php.ini include_path


 /opt/packages/php-5.4.0/build/shtool install -c ext/phar/phar.phar /usr/local/bin
 ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar

6-Make  as defaults 

ln -s /usr/local/bin/php /usr/bin/

7-Check  Now the  version installed 

[root@hosted php-5.4.0]# php -v
Output
PHP 5.4.0 (cli) (built: Mar 19 2012 11:33:22)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
You have new mail in /var/spool/mail/root
[root@hosted php-5.4.0]#

 Feel free to post your question on our http://ask.unixmen.com