<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vtrio Sysadmins &#187; php</title>
	<atom:link href="https://sysadmin.vtrio.com/?feed=rss2&#038;tag=php" rel="self" type="application/rss+xml" />
	<link>https://sysadmin.vtrio.com</link>
	<description></description>
	<lastBuildDate>Fri, 11 May 2018 07:40:10 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>Multiple php versions on Centos</title>
		<link>https://sysadmin.vtrio.com/?p=106</link>
		<comments>https://sysadmin.vtrio.com/?p=106#comments</comments>
		<pubDate>Wed, 05 Feb 2014 06:28:22 +0000</pubDate>
		<dc:creator><![CDATA[]]></dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[multiplephp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://sysadmin.vtrio.com/?p=106</guid>
		<description><![CDATA[Hi , you may come across situations to have multiple php versions installed on a server. Here I will explain a simple method to accomplish this. Lets take php versions 5.2 and 5.4 and I am going to install it in different locations than default installation directory. Note for 2 versions of php one version]]></description>
				<content:encoded><![CDATA[<p>Hi , you may come across situations to have multiple php versions installed on a server. Here I will explain a simple method to accomplish this. Lets take php versions 5.2 and 5.4 and I am going to install it in different locations than default installation directory.</p>
<p>Note for 2 versions of php one version should be compiled as fcgi.</p>
<p>1. Install php 5.2:</p>
<p>a. Download php tar file from &#8220;http://php.net/downloads.php&#8221;</p>
<p>Here I am going to compile this php as fastcgi and using custom installation directory /opt/php52. Configure command is given below.</p>
<p>==========</p>
<p># ./configure &#8211;prefix=/opt/php52 &#8211;with-config-file-path=/opt/php52 &#8211;with-curl &#8211;enable-cli &#8211;enable-fastcgi &#8211;enable-discard-path &#8211;enable-force-cgi-redirect &#8211;with-mysql &#8211;with-mysqli &#8211;enable-bcmath &#8211;enable-ftp &#8211;enable-magic-quotes &#8211;with-pear &#8211;enable-sockets &#8211;with-zlib &#8211;with-gd &#8211;with-jpeg-dir=/usr/lib &#8211;with-libdir=lib64 &#8211;with-bz2 &#8211;enable-calendar &#8211;with-curl &#8211;enable-dbase &#8211;enable-exif &#8211;with-gettext &#8211;with-gmp &#8211;enable-mbstring &#8211;with-mcrypt &#8211;with-mhash &#8211;with-ncurses=shared &#8211;with-openssl &#8211;enable-pcntl &#8211;with-pdo-mysql &#8211;with-pspell &#8211;with-readline &#8211;enable-shmop &#8211;with-snmp=shared &#8211;enable-sysvsem &#8211;enable-sysvshm &#8211;enable-sysvmsg &#8211;enable-wddx &#8211;with-kerberos &#8211;with-imap-ssl &#8211;enable-zip &#8211;with-xsl &#8211;with-tidy &#8211;enable-soap</p>
<p># make &amp;&amp; make install</p>
<p>============</p>
<p>If you got error while executing &#8216;make&#8217; command  like &#8220;Compile: /usr/bin/ld: cannot find -lltdl, collect2: ld returned 1 exit status&#8221; please install libtool using following command.</p>
<p>yum install libtool-ltdl-devel</p>
<p><span style="line-height: 1.5em"> </span></p>
<p>Copy php.ini-recommended from the install directory to /opt/php52/</p>
<p>&nbsp;</p>
<p>2. Install php 5.4</p>
<p>This one also going to install in separate location say /opt/php54</p>
<p>===========</p>
<p>#./configure &#8211;prefix=/opt/php54 &#8211;with-config-file-path=/opt/php54 &#8211;with-curl &#8211;enable-cli &#8211;enable-discard-path &#8211;with-mysql &#8211;with-mysqli &#8211;enable-bcmath &#8211;enable-ftp &#8211;enable-magic-quotes &#8211;with-pear &#8211;enable-sockets &#8211;with-zlib &#8211;with-gd &#8211;with-jpeg-dir=/usr/lib &#8211;with-libdir=lib64 &#8211;with-bz2 &#8211;enable-calendar &#8211;with-curl &#8211;enable-dbase &#8211;enable-exif &#8211;with-gettext &#8211;with-gmp &#8211;enable-mbstring &#8211;with-mcrypt &#8211;with-mhash &#8211;with-ncurses=shared &#8211;with-openssl &#8211;enable-pcntl &#8211;with-pdo-mysql &#8211;with-pspell &#8211;with-readline &#8211;enable-shmop &#8211;with-snmp=shared &#8211;enable-sysvsem &#8211;enable-sysvshm &#8211;enable-sysvmsg &#8211;enable-wddx &#8211;with-kerberos &#8211;with-imap-ssl &#8211;enable-zip &#8211;with-xsl &#8211;with-tidy &#8211;enable-soap</p>
<p># make &amp;&amp; make install</p>
<p>===========</p>
<p>&nbsp;</p>
<p>Copy php.ini-production from install directory to /opt/php54.</p>
<p>&nbsp;</p>
<p>Now in apache configuration file include following line or uncomment it.</p>
<p>&nbsp;</p>
<p>Include conf/extra/httpd-fastcgi.conf</p>
<p>&nbsp;</p>
<p>Now create this file &#8220;/usr/local/apache/conf/extra/httpd-fastcgi.conf&#8221; and add below contents to it.</p>
<p>&nbsp;</p>
<p>==========</p>
<p>LoadModule fastcgi_module modules/mod_fastcgi.so<br />
FastCgiIpcDir /opt/tmp/fcgi<br />
AddHandler fastcgi-script .fcgi<br />
FastCgiConfig -autoUpdate -singleThreshold 200 -killInterval 600 -idle-timeout 150<br />
AddType application/x-httpd-php .php<br />
ScriptAlias /fastcgi/ /usr/local/apache/cgi-bin/<br />
&lt;Directory &#8220;/usr/local/apache/cgi-bin&#8221;&gt;<br />
Options ExecCGI<br />
SetHandler fastcgi-script<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Directory&gt;</p>
<p>==========</p>
<p>&nbsp;</p>
<p>Make sure that &#8220;mod_fastcgi.so&#8221; exists in the modules directory. Now create a directory &#8220;/opt/tmp/fcgi&#8221; and give 777 permission.</p>
<p>&nbsp;</p>
<p>Navigate to directory &#8220;/usr/local/apache/cgi-bin/&#8221;.</p>
<p>a. Create a file for php 5.2 say &#8220;php52.fcgi&#8221; with 755 or executable permission and add following contents to it. Make sure you have added correct path for php-cgi binary.</p>
<p>&nbsp;</p>
<p>==========</p>
<p>#!/bin/sh<br />
PHP_FCGI_CHILDREN=8<br />
export PHP_FCGI_CHILDREN<br />
PHP_FCGI_MAX_REQUESTS=5000<br />
export PHP_FCGI_MAX_REQUESTS<br />
exec /opt/php52/bin/php-cgi</p>
<p>==========</p>
<p>&nbsp;</p>
<p>Similarly create a file for php 5.4 say php54.cgi with following contents.</p>
<p>&nbsp;</p>
<p>==========</p>
<p>#!/bin/sh<br />
PHP_FCGI_CHILDREN=8<br />
export PHP_FCGI_CHILDREN<br />
PHP_FCGI_MAX_REQUESTS=5000<br />
export PHP_FCGI_MAX_REQUESTS<br />
exec /opt/php54/bin/php-cgi</p>
<p>==========</p>
<p>&nbsp;</p>
<p>Finally go to virtual host section of each domain and specify which php to use for the domain. Imagine I have to use php 5.2 for a domain called abc.com. Go to virtual host of domain abc.com and add following line to it.</p>
<p>&nbsp;</p>
<p>==========</p>
<p>Action  application/x-httpd-php /fastcgi/php52.fcgi</p>
<p>==========</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>For domains using php version 5.4 add following line.</p>
<p>&nbsp;</p>
<p>==========</p>
<p>Action  application/x-httpd-php /fastcgi/php54.fcgi</p>
<p>==========</p>
<p>&nbsp;</p>
<p>Finally restart apache service. Thats it. Put a php info page and check php versions displaying.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Thanks,</p>
<p>Jeen</p>
]]></content:encoded>
			<wfw:commentRss>https://sysadmin.vtrio.com/?feed=rss2&#038;p=106</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
