<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://briansnelson.com/index.php?action=history&amp;feed=atom&amp;title=Install_the_Latest_version_PHP_on_CentOS</id>
		<title>Install the Latest version PHP on CentOS - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://briansnelson.com/index.php?action=history&amp;feed=atom&amp;title=Install_the_Latest_version_PHP_on_CentOS"/>
		<link rel="alternate" type="text/html" href="https://briansnelson.com/index.php?title=Install_the_Latest_version_PHP_on_CentOS&amp;action=history"/>
		<updated>2026-06-04T09:59:35Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://briansnelson.com/index.php?title=Install_the_Latest_version_PHP_on_CentOS&amp;diff=709&amp;oldid=prev</id>
		<title>Brian: Created page with &quot;===Install the Latest version PHP on CentOS===  I currently run a development server that I need to use different versions of php, including the most recent version of php.  Y...&quot;</title>
		<link rel="alternate" type="text/html" href="https://briansnelson.com/index.php?title=Install_the_Latest_version_PHP_on_CentOS&amp;diff=709&amp;oldid=prev"/>
				<updated>2014-04-28T17:33:29Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;===Install the Latest version PHP on CentOS===  I currently run a development server that I need to use different versions of php, including the most recent version of php.  Y...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===Install the Latest version PHP on CentOS===&lt;br /&gt;
&lt;br /&gt;
I currently run a development server that I need to use different versions of php, including the most recent version of php.  You will notice that yum ususally does not have the lastest version of php. So you will probably need to compile the most recent version your self.&lt;br /&gt;
&lt;br /&gt;
Below are the steps used to compile the lastest version PHP.&lt;br /&gt;
&lt;br /&gt;
===1) Install Tools to compile===&lt;br /&gt;
&lt;br /&gt;
You can use yum to install the tools and other files&lt;br /&gt;
&lt;br /&gt;
 yum install gcc-c++ httpd httpd-devel apr-devel libxml2-devel zlib zlib-devel mysql-devel openssl-devel -y&lt;br /&gt;
&lt;br /&gt;
I will assume you already have httpd and mysql installed on your server, if not you might want to install them now as well.&lt;br /&gt;
&lt;br /&gt;
===2) Download the latest version PHP===&lt;br /&gt;
&lt;br /&gt;
Any time I need to download remote files I put them in /downloads, so lets create this directory if its not already created&lt;br /&gt;
&lt;br /&gt;
 mkdir /downloads &amp;amp;&amp;amp; cd /downloads&lt;br /&gt;
&lt;br /&gt;
At the time of this how to, the latest version is php5.5.11 so lets download it from http://us3.php.net/downloads.php&lt;br /&gt;
&lt;br /&gt;
 wget http://us1.php.net/get/php-5.5.11.tar.gz/from/this/mirror&lt;br /&gt;
&lt;br /&gt;
This file will save as mirror, so lets change the name to php-5.5.11.tar.gz&lt;br /&gt;
&lt;br /&gt;
 mv mirror php-5.5.11.tar.gz&lt;br /&gt;
&lt;br /&gt;
Extract the tarball&lt;br /&gt;
&lt;br /&gt;
 tar -zxfv php-5.5.11.tar.gz&lt;br /&gt;
&lt;br /&gt;
Move into that directory&lt;br /&gt;
&lt;br /&gt;
 cd php-5.5.11&lt;br /&gt;
&lt;br /&gt;
===Configure and Make===&lt;br /&gt;
&lt;br /&gt;
To get a list of configure options you can run&lt;br /&gt;
&lt;br /&gt;
 ./configure --help&lt;br /&gt;
&lt;br /&gt;
Here are the options I am currently using, you can and will propbably want to adjust this string depending on your needs.&lt;br /&gt;
&lt;br /&gt;
 ./configure --with-config-file-path=/etc/php55 --with-config-file-scan-dir=/etc/php55.d --with-apxs2 --with-libdir=lib64/php55 --with-zlib --with-mysql --with-mysqli  --enable-ftp --with-openssl --enable-xml --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu&lt;br /&gt;
&lt;br /&gt;
You will notice that I adjust some of the folders to read php55, this is because I have other versions of php installed on this server and I like having the ability to switch between different version of php for development reasons.&lt;br /&gt;
&lt;br /&gt;
Now its time to make and install php&lt;br /&gt;
&lt;br /&gt;
 make &amp;amp;&amp;amp; make install&lt;br /&gt;
&lt;br /&gt;
===Now lets change some files===&lt;br /&gt;
&lt;br /&gt;
By default this will become the default installation, but as I have stated, this is just one version of php on the server.&lt;br /&gt;
&lt;br /&gt;
Lets locate and change the php file&lt;br /&gt;
&lt;br /&gt;
 which php&lt;br /&gt;
 /usr/local/bin/php&lt;br /&gt;
&lt;br /&gt;
So lets move this php55 and leave it as the current default as well&lt;br /&gt;
&lt;br /&gt;
 cp /usr/local/bin/php /usr/local/bin/php55&lt;br /&gt;
&lt;br /&gt;
Now lets confirm its working&lt;br /&gt;
&lt;br /&gt;
 php55 -v&lt;br /&gt;
 PHP 5.5.11 (cli) (built: Apr 28 2014 00:09:03) &lt;br /&gt;
 Copyright (c) 1997-2014 The PHP Group&lt;br /&gt;
 Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies&lt;br /&gt;
&lt;br /&gt;
Now lets change the .so file that apache calls&lt;br /&gt;
&lt;br /&gt;
 mv /usr/lib64/httpd/modules/libphp5.so /usr/lib64/httpd/modules/libphp55.so&lt;br /&gt;
&lt;br /&gt;
Now adjust apache to use the new libphp55.so location&lt;br /&gt;
&lt;br /&gt;
 vim /etc/httpd/conf/httpd.conf&lt;br /&gt;
&lt;br /&gt;
Find the file that now says&lt;br /&gt;
&lt;br /&gt;
 LoadModule php5_module        /usr/lib64/httpd/modules/libphp5.so&lt;br /&gt;
&lt;br /&gt;
and change it to point to the new file&lt;br /&gt;
&lt;br /&gt;
 LoadModule php5_module        /usr/lib64/httpd/modules/libphp55.so&lt;br /&gt;
&lt;br /&gt;
Now lets make the php55 config location and additional modules directory.&lt;br /&gt;
&lt;br /&gt;
 mkdir -p /etc/php55/ &amp;amp;&amp;amp; mkdir -p /etc/php55.d/&lt;br /&gt;
&lt;br /&gt;
Now lets install the php.ini file,&lt;br /&gt;
&lt;br /&gt;
 cp /download/php-5.5.11/php.ini-production /etc/php55/php.ini&lt;br /&gt;
&lt;br /&gt;
===Restart Apache/httpd===&lt;br /&gt;
&lt;br /&gt;
Lets restart apache/httpd to confirm everything is working correctly&lt;br /&gt;
&lt;br /&gt;
 httpd -t&lt;br /&gt;
&lt;br /&gt;
If nothing is wrong, restart time&lt;br /&gt;
&lt;br /&gt;
 httpd -k restart&lt;br /&gt;
&lt;br /&gt;
===Testing apache with phpinfo file===&lt;br /&gt;
&lt;br /&gt;
Lets create a phpinfo file&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;&amp;lt;?php phpinfo();&amp;quot; &amp;gt; /var/www/html/phpinfo.php&lt;br /&gt;
&lt;br /&gt;
Check out that file in your browser to verify its using the correct version of php.&lt;/div&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	</feed>