<?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>Paul Turner &#187; PHP</title>
	<atom:link href="http://paulturner.me/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulturner.me</link>
	<description>bits and pieces</description>
	<lastBuildDate>Mon, 10 Oct 2011 16:06:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The domain switch</title>
		<link>http://paulturner.me/2009/01/the-domain-switch/</link>
		<comments>http://paulturner.me/2009/01/the-domain-switch/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 15:04:12 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://paulturner.me/?p=87</guid>
		<description><![CDATA[After much procrastination I have finally made the domain switch over to paulturner.me. All requests to the original domain paul-turner.net are automatically redirected to the correct page on the new domain with a &#8220;301 Moved Permanently&#8221; HTTP header. This means that all search engine traffic should be preserved, and the links updated over time. This [...]]]></description>
			<content:encoded><![CDATA[<p>After much procrastination I have finally made the domain switch over to <a href="http://paulturner.me/">paulturner.me</a>.</p>
<p>All requests to the original domain <a href="http://paul-turner.net/">paul-turner.net</a> are automatically redirected to the correct page on the new domain with a &#8220;301 Moved Permanently&#8221; HTTP header.</p>
<p>This means that all search engine traffic should be preserved, and the links updated over time.</p>
<p>This was achieved simply with mod_rewrite and a single index.php page:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: http://paulturner.me'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">301</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<p>Please update your links.</p>
]]></content:encoded>
			<wfw:commentRss>http://paulturner.me/2009/01/the-domain-switch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing PHP XCache on CentOS 5</title>
		<link>http://paulturner.me/2008/08/installing-php-xcache-on-centos-5/</link>
		<comments>http://paulturner.me/2008/08/installing-php-xcache-on-centos-5/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 09:35:19 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://paul-turner.net/?p=19</guid>
		<description><![CDATA[XCache is a PHP opcode cacher, which basically means that it will cache the compiled code the first time a PHP page/script is executed thus avoiding the compilation step on subsequent executions. I used the 1.2.2. release of XCache and followed the quick guide instructions to install from source. The installation requires that the php-devel [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://xcache.lighttpd.net/">XCache</a> is a PHP opcode cacher, which basically means that it will cache the compiled code the first time a PHP page/script is executed thus avoiding the compilation step on subsequent executions.</p>
<p>I used the <a href="http://xcache.lighttpd.net/wiki/Release-1.2.2">1.2.2.</a> release of XCache and followed the <a href="http://xcache.lighttpd.net/wiki/InstallFromSource">quick guide</a> instructions to install from source.</p>
<p>The installation requires that the php-devel package is installed.  This is required to compile PHP extensions (the comand phpize is required for this installation).</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@testserver xcache-1.2.2]# yum install php-devel<br />
Dependencies Resolved<br />
=============================================================================<br />
&nbsp;Package &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Arch &nbsp; &nbsp; &nbsp; Version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Repository &nbsp; &nbsp; &nbsp; &nbsp;Size<br />
=============================================================================<br />
Installing:<br />
&nbsp;php-devel &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 512 k<br />
Updating for dependencies:<br />
&nbsp;php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1.1 M<br />
&nbsp;php-cli &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2.1 M<br />
&nbsp;php-common &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 154 k<br />
&nbsp;php-gd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 113 k<br />
&nbsp;php-ldap &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;35 k<br />
&nbsp;php-mbstring &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 969 k<br />
&nbsp;php-mysql &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;84 k<br />
&nbsp;php-pdo &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;62 k<br />
&nbsp;php-xml &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i386 &nbsp; &nbsp; &nbsp; 5.1.6-20.el5_2.1 &nbsp;updates &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;94 k<br />
Transaction Summary<br />
=============================================================================<br />
Install &nbsp; &nbsp; &nbsp;1 Package(s)<br />
Update &nbsp; &nbsp; &nbsp; 9 Package(s)<br />
Remove &nbsp; &nbsp; &nbsp; 0 Package(s)<br />
Total download size: 5.2 M<br />
Is this ok [y/N]:</div></div>
<p>It appears that this will also update the core PHP package and dependancies, so care should be taken.  Try this on a test server and not your production server! </p>
<p>Here are the steps I took to install XCache:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@testserver ~]# tar -zxf xcache-1.2.2.tar.gz<br />
[root@testserver ~]# cd xcache-1.2.2<br />
[root@testserver xcache-1.2.2]# phpize<br />
[root@testserver xcache-1.2.2]# ./configure --enable-xcache<br />
[root@testserver xcache-1.2.2]# make<br />
[root@testserver xcache-1.2.2]# make install<br />
[root@testserver xcache-1.2.2]# cp /etc/php.ini /etc/php.ini.bk<br />
[root@testserver xcache-1.2.2]# cat xcache.ini &gt;&gt; /etc/php.ini</div></div>
<p>In my configuration the xcache.ini and resulting php.ini had the wrong path to the module that has been installed.  The module was installed in /usr/lib/php/modules/ but the configuration was looking in /usr/local/lib/php/extensions/non-debug-non-zts-xxx/.  </p>
<p>All that was needed was a simple change to the configuration file to comment out the fully qualified path and tell it to use the extensions directory:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[xcache-common]<br />
;; install as zend extension (recommended), normally &quot;$extension_dir/xcache.so&quot;<br />
;; zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so<br />
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so<br />
;; For windows users, replace xcache.so with php_xcache.dll<br />
;; zend_extension_ts = c:/php/extensions/php_xcache.dll<br />
;; or install as extension, make sure your extension_dir setting is correct<br />
&nbsp;extension = xcache.so<br />
;; or win32:<br />
; extension = php_xcache.dll</div></div>
<p>Then just check it&#8217;s installed:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@testserver xcache-1.2.2]# php -v<br />
PHP 5.1.6 (cli) (built: Jul 16 2008 19:53:00)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies<br />
&nbsp; &nbsp; with XCache v1.2.2, Copyright (c) 2005-2007, by mOo</div></div>
<p>Success!  However Apache must be restarted in order for this to work with PHP web pages.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">service httpd restart</div></div>
<p>Now if you access a page containing the phpinfo(); function you should be able to search for XCache and find it.</p>
<p>XCache is now installed and running.</p>
<p>I did not see the need to install the php-devel package on our live servers and I know that our live servers are identical to our test servers other than hard disk and memory sizes (we use VMWare extensively and they come from the same template).</p>
<p>This means that all the binaries compiled on the test server should be compatible with our live servers, so I just copied the xcache-1.2.2 folder from the test server and followed the above steps again starting with the &#8220;make install&#8221; step.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@testserver ~]# tar -cvzf xcache-install.tgz xcache-1.2.2/</div></div>
<p>copy this to the /root/ directory on the live server</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@liveserver ~]# tar -xvzf xcache-install.tgz<br />
[root@liveserver xcache-1.2.2]# make install<br />
[root@liveserver xcache-1.2.2]# cp /etc/php.ini /etc/php.ini.bk<br />
[root@liveserver xcache-1.2.2]# cat xcache.ini &gt;&gt; /etc/php.ini<br />
[root@liveserver xcache-1.2.2]# vi /etc/php.ini<br />
[root@liveserver xcache-1.2.2]# php -v<br />
PHP 5.1.6 (cli) (built: Sep 20 2007 10:16:10)<br />
Copyright (c) 1997-2006 The PHP Group<br />
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies<br />
&nbsp; &nbsp; with XCache v1.2.2, Copyright (c) 2005-2007, by mOo</div></div>
]]></content:encoded>
			<wfw:commentRss>http://paulturner.me/2008/08/installing-php-xcache-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

