<?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>Holy Shmoly! &#187; PHP</title>
	<atom:link href="http://ocaoimh.ie/tag/PHP/feed/" rel="self" type="application/rss+xml" />
	<link>http://ocaoimh.ie</link>
	<description>Look what I found today!</description>
	<lastBuildDate>Fri, 25 May 2012 17:12:43 +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>cSprites for PHP 5.3.1/2</title>
		<link>http://ocaoimh.ie/2011/01/04/csprites-php-5312/</link>
		<comments>http://ocaoimh.ie/2011/01/04/csprites-php-5312/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 16:53:03 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[csprites]]></category>
		<category><![CDATA[irishblogs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/?p=89496109</guid>
		<description><![CDATA[Joost posted a great article on reducing http requests on WordPress sites recently and one comment caught my attention. Nabil mentioned cSprites. It&#8217;s a WordPress plugin that merges the images in your posts into one file and uses CSS to position the single merged file in place of the original images. Here&#8217;s a good post [...]]]></description>
			<content:encoded><![CDATA[<p>Joost posted a great article on <a href="http://yoast.com/reduce-http-requests-wordpress/">reducing http requests</a> on WordPress sites recently and one comment caught my attention. Nabil mentioned <a href="http://wordpress.org/extend/plugins/csprites-for-wordpress/">cSprites</a>. It&#8217;s a WordPress plugin that merges the images in your posts into one file and uses CSS to position the single merged file in place of the original images. Here&#8217;s a good <a href="http://css-tricks.com/css-sprites/">post</a> explaining how this technique works.</p>
<p>Unfortunately it hasn&#8217;t been updated in over a year, and the current version doesn&#8217;t work if you have PHP 5.3.2 (and probably 5.3.1) as it trips over <a href="http://stackoverflow.com/questions/2045875/pass-by-reference-problem-with-php-5-3-1">this PHP bug</a>. The fix is simple, get rid of call_user_func_array() and call the functions directly.</p>
<p>I had it installed here and it worked well enough but not perfectly. <a href="http://wordpress.org/support/topic/plugin-csprites-speed-up-page-load-time-with-dynamic-image-sprites-php-532-callback-problem?replies=1">Here&#8217;s the post</a> I made on the plugin&#8217;s support forum if anyone&#8217;s interested.</p>
<p>I don&#8217;t think the author will update the plugin again and in fact <a href="http://www.mummey.org/csprites/">he&#8217;s looking for someone else</a> to take over. Anyone?</p>
<p><strike>The plugin has been running on <a href="http://inphotos.org/">my photoblog</a> for the last hour ago and I haven&#8217;t noticed any problems yet. As a bonus, it also stops people right clicking and </strike><strike>stealing</strike> saving my photos for their own use. I&#8217;ve since removed it as visitors were only seeing blank images. Oh well.</p>
<p>So, want to give a &#8220;fixed version&#8221; a go? Grab <a href="http://ocaoimh.ie/wp-content/uploads/2011/01/csprites-for-wordpress.zip">csprites-for-wordpress.zip</a> and install it in the usual way. Support queries should be directed towards the <a href="http://wordpress.org/tags/csprites-for-wordpress">plugin support forum</a>. <img src='http://ocaoimh.ie/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Oh yeah, there&#8217;s also the <a href="http://spriteme.org/">SpriteMe</a> bookmarklet if you don&#8217;t want to go fiddling with WordPress plugins!</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89496109" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> No related posts</li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2011/01/04/csprites-php-5312/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>PHP is_numeric() vs is_int()</title>
		<link>http://ocaoimh.ie/2009/03/31/php-is_numeric-vs-is_int/</link>
		<comments>http://ocaoimh.ie/2009/03/31/php-is_numeric-vs-is_int/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 14:46:33 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[irishblogs]]></category>
		<category><![CDATA[is_int]]></category>
		<category><![CDATA[is_numeric]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/?p=89494711</guid>
		<description><![CDATA[Some lessons you don&#8217;t forget, but this one I did because it doesn&#8217;t come up very often. Don&#8217;t use is_int() because, as Jeremy says, it&#8217;ll lie to you. Use is_numeric() instead. Copy the following chunk of code into a php file and run it. You&#8217;ll be surprised at the outcome: $t = "12345"; if( is_int($t [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://inphotos.org/good-food-causes-cancer/"><img style='border: 1px solid #333;margin-left: 5px' src="http://inphotos.org/wp-content/uploads/2009/01/good-food-causes-cancer-150x150.jpg" align='right' border="0" /></a> Some lessons you don&#8217;t forget, but this one I did because it doesn&#8217;t come up very often.</p>
<p>Don&#8217;t use is_int() because, <a href="http://jeremy.zawodny.com/blog/archives/001503.html">as Jeremy says</a>, it&#8217;ll lie to you. Use is_numeric() instead.</p>
<p>Copy the following chunk of code into a php file and run it. You&#8217;ll be surprised at the outcome:</p>
<blockquote><p><code>$t = "12345";<br />
if( is_int($t ) ) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo $t . " is an int!";<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo $t . " is not an int!";<br />
}</code></p></blockquote>
<p>The problem is that is_int() thinks a string of numbers is a string, not an integer. The <a href="http://ie2.php.net/manual/en/function.is-int.php">is_int() man page</a> has an example illustrating that but it&#8217;s easy to miss. That function should carry a public health warning! </p>
<p>There&#8217;s also the <a href="http://ie.php.net/manual/en/function.ctype-digit.php">ctype_digit()</a> function too but it has it&#8217;s own gotcha:<br />
<blockquote>Note: This function require a string to be useful, so for example passing in an integer will always return FALSE. However, also note that HTML Forms will result in numeric strings and not integers. See also the types section of the manual. </p></blockquote>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89494711" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> No related posts</li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2009/03/31/php-is_numeric-vs-is_int/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>No activity within 1800 seconds; please log in again</title>
		<link>http://ocaoimh.ie/2008/03/12/no-activity-within-1800-seconds-please-log-in-again/</link>
		<comments>http://ocaoimh.ie/2008/03/12/no-activity-within-1800-seconds-please-log-in-again/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 15:36:56 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[irishblogs]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2008/03/12/no-activity-within-1800-seconds-please-log-in-again/</guid>
		<description><![CDATA[1800 seconds is such a long time, right? It&#8217;s 30 minutes. It&#8217;s 0.5 hours. It&#8217;s 0.0208333333 days. It&#8217;s also 5.70397764 × 10-5 years. And it&#8217;s not long enough for me. phpMyAdmin logs you out after 1800 seconds, obviously for security reasons. That&#8217;s fine if there are other people about, if I was in an office [...]]]></description>
			<content:encoded><![CDATA[<p>1800 seconds is such a long time, right?</p>
<ol>
<li> It&#8217;s <a href="http://www.google.ie/search?q=convert+1800+seconds+to+minutes">30 minutes</a>.</li>
<li> It&#8217;s <a href="http://www.google.ie/search?q=convert+1800+seconds+to+hours">0.5 hours</a>.</li>
<li> It&#8217;s <a href="http://www.google.ie/search?q=convert+1800+seconds+to+days">0.0208333333 days</a>.</li>
<li> It&#8217;s also <a href="http://www.google.ie/search?q=convert+1800+seconds+to+years">5.70397764 × 10<sup>-5</sup> years</a>.</li>
</ol>
<p>And it&#8217;s not long enough for me. phpMyAdmin logs you out after 1800 seconds, obviously for security reasons. That&#8217;s fine if there are other people about, if I was in an office with people coming and going, but I work from home. All I see for most of the day is my family, the radio, my messy desk, computers, and the view out the window. Time to figure out how to make that 1800 second limit a little longer or remove it altogether.</p>
<p>After a little digging, I discovered that extending the time limit to a day is actually quite easy. Open your phpMyAdmin&#8217;s config.inc.php and search for or add the following line:</p>
<blockquote><p><code>$cfg['LoginCookieValidity']     = 86400;</code></p></blockquote>
<p>Refresh your logged out phpMyAdmin and presuming you haven&#8217;t left it idle for 24 hours, you&#8217;ll be logged in again!</p>
<p>If the time limit really bugs you, you need http authentication. Look for the &#8220;auth_type&#8221; line in the config.inc.php and change that to &#8220;http&#8221;. phpMyAdmin won&#8217;t log you out as long as your browser is open. Perfect!</p>
<p>If you&#8217;re concerned about sending your MySQL username and password in the clear each time you make a request to phpMyAdmin you can either use SSL or try the &#8220;config&#8221; auth_type. Make sure you fill in the username and password fields in the config file, and secure the phpMyAdmin directory with a htpasswd file.</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89493604" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2002/11/21/hot-babe-hot-babe-is/" rel="bookmark" title="Permanent Link: Hot Babe Hot-babe is a small g &#8230;">Hot Babe Hot-babe is a small g &#8230;</a></li><li> <a href="http://ocaoimh.ie/2004/02/17/ask-an-irish-woman-about-drink/" rel="bookmark" title="Permanent Link: Ask an Irish woman about drink?">Ask an Irish woman about drink?</a></li><li> <a href="http://ocaoimh.ie/2010/04/11/modern-warfare-2-nuke-in-8-seconds/" rel="bookmark" title="Permanent Link: Modern Warfare 2 nuke in 8 seconds">Modern Warfare 2 nuke in 8 seconds</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2008/03/12/no-activity-within-1800-seconds-please-log-in-again/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Ping. The ping heard across the world</title>
		<link>http://ocaoimh.ie/2008/01/11/ping-the-ping-heard-across-the-world/</link>
		<comments>http://ocaoimh.ie/2008/01/11/ping-the-ping-heard-across-the-world/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 19:07:57 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[allow_url_fopen]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[litespeed]]></category>
		<category><![CDATA[lsws]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ping]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2008/01/11/ping-the-ping-heard-across-the-world/</guid>
		<description><![CDATA[If you&#8217;re wondering why trackbacks and pings aren&#8217;t working on your blog then you might want to do what I did earlier today: allow your blog to talk to other servers. WordPress needs either allow_url_fopen to be set On or to have the Curl extension loaded. If you&#8217;re having problems receiving pings from other blogs [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re wondering why trackbacks and pings aren&#8217;t working on your blog then you might want to do what I did earlier today: allow your blog to talk to other servers.</p>
<p>WordPress needs either <code>allow_url_fopen</code> to be set <code>On</code> or to have the Curl extension loaded. If you&#8217;re having problems receiving pings from other blogs then both of these are probably turned off or missing. Wouldn&#8217;t it be nice if Options-&gt;Discussion warned that pings wouldn&#8217;t work?</p>
<p>Look in your php.ini, or the output of phpinfo() to check for both. If you want to enable fopen, then the entry in php.ini should look like this:</p>
<blockquote><p>;;;;;;;;;;;;;;;;;;<br />
; Fopen wrappers ;<br />
;;;;;;;;;;;;;;;;;;</p>
<p>; Whether to allow the treatment of URLs (like http:// or ftp://) as files.<br />
allow_url_fopen = On</p></blockquote>
<p>I <a href="http://ocaoimh.ie/2007/11/12/100000-page-views-in-5-minutes/">switched</a> to <a href="http://litespeedtech.com/">Litespeed web server</a> a while back  and by default <code>allow_url_fopen</code> is set to Off and the curl library isn&#8217;t included. Check /opt/lsws/php/php.ini and make sure remote fopens are allowed!</p>
<p>Thanks <a href="http://barry.wordpress.com/">Barry</a> for helping me fix that.</p>
<p>PS. if you linked to this blog recently, feel free to save your post again. WordPress will ping my site again and this time the ping will get through.</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89493530" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2004/03/02/cherry-blossom-girl-c64-rip-off/" rel="bookmark" title="Permanent Link: Cherry Blossom Girl &#8211; C64 rip off?">Cherry Blossom Girl &#8211; C64 rip off?</a></li><li> <a href="http://ocaoimh.ie/2002/08/19/heard-on-ircnia/" rel="bookmark" title="Permanent Link: Heard on IRC:&lt;Niall&gt; What w &#8230;">Heard on IRC:&lt;Niall&gt; What w &#8230;</a></li><li> <a href="http://ocaoimh.ie/2006/10/06/ping-google-too/" rel="bookmark" title="Permanent Link: Ping Google Too!">Ping Google Too!</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2008/01/11/ping-the-ping-heard-across-the-world/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Donncha&#039;s Thursday Links</title>
		<link>http://ocaoimh.ie/2007/11/15/donnchas-thursday-links-2007-11-15/</link>
		<comments>http://ocaoimh.ie/2007/11/15/donnchas-thursday-links-2007-11-15/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 10:19:55 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[Donncha's Links]]></category>
		<category><![CDATA[irishblogs]]></category>
		<category><![CDATA[organic]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2007/11/15/donnchas-thursday-links-2007-11-15/</guid>
		<description><![CDATA[I have to admit, I preferred how WP 2.2 displayed lots of draft posts on the edit and post pages. Having to go to the Write page and click on the &#8220;54 more&#8221; link is annoying. For some reason, this post didn&#8217;t show up as the newest draft. Now it does, maybe because I deleted [...]]]></description>
			<content:encoded><![CDATA[<p>I have to admit, I preferred how WP 2.2 displayed lots of draft posts on the edit and post pages. Having to go to the Write page and click on the &#8220;54 more&#8221; link is annoying. For some reason, this post didn&#8217;t show up as the newest draft. Now it does, maybe because I deleted another  (newer) draft post of the same name. When I created another &#8220;Donncha&#8217;s Thursday Links&#8221; post it didn&#8217;t show in the drafts list either. I had to search the drafts posts for &#8220;donncha&#8221; and it appeared at the bottom of that list. Strange.</p>
<p>I should get used to having my photos ripped off, but <a href="http://inphotos.org/olearys-camera-world-make-me-angry/">I don&#8217;t think I ever will</a>. It&#8217;s as upsetting now as it ever was.</p>
<ul>
<li><a href="http://offthemeatrack.wordpress.com/2007/11/06/the-shocking-truth-about-princess-diana/">The Shocking Truth About Princess Diana!</a> &#8211; is Meatrack on to something here?</li>
<li><a href="http://ocaoimh.ie/2007/11/14/donnchas-wednesday-links-2007-11-14/">yesterday&#8217;s wedding photo</a>, here are <a href="http://divinecaroline.com/article/22072/37887">a few more</a> to enjoy!</li>
<li><a href="http://www.photub.com/2007/Nov/06/photojojo-forums-tips/">How to take the foto of &#8216;that stranger&#8217;</a> offers a few hints for the budding street photographer. Remember that model release! You can&#8217;t license your images for most uses if you haven&#8217;t got one!</li>
<li>PHP 5.1.6 and up <a href="http://ie2.php.net/manual/en/function.mkdir.php#73848">have an annoying bug</a>. If a directory name has a slash at the end the mkdir() command will fail. Thanks <a href="http://www.tummblr.com/">Tummblr</a> for tracking that down!</li>
<li>I love the <a href="http://flak-photo.my-expressions.com/archives/6333_1646490288/264955">light and shadow</a> in this image.</li>
<li>Conor asks <a href="http://www.ireland.com/blogs/pricewatch/2007/11/12/organic-is-it-worth-it/">Organic &#8211; is it worth it?</a>. A recent study on organic foods, &#8220;indicate that up to 40 per cent more antioxidants and other beneficial compounds are to be found in vegetable crops, and up to 90 per cent more in milk.&#8221; The study hasn&#8217;t been peer-reviewed yet however.</li>
</ul>
<p>PS. Ray D&#8217;Arcy appears on the Restaurant tonight on RTE 1 at 8.30pm!</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89493409" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2007/11/08/donnchas-thursday-links-2007-11-07/" rel="bookmark" title="Permanent Link: Donncha&#039;s Thursday Links">Donncha&#039;s Thursday Links</a></li><li> <a href="http://ocaoimh.ie/2007/11/21/a-simply-silly-wordpress-url/" rel="bookmark" title="Permanent Link: A Simply Silly WordPress URL">A Simply Silly WordPress URL</a></li><li> <a href="http://ocaoimh.ie/2007/11/22/donnchas-wednesday-links-2007-11-22/" rel="bookmark" title="Permanent Link: Donncha&#039;s Wednesday Links">Donncha&#039;s Wednesday Links</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2007/11/15/donnchas-thursday-links-2007-11-15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is your eAccelerator cache dir still there?</title>
		<link>http://ocaoimh.ie/2007/09/05/is-your-eaccelerator-cache-dir-still-there/</link>
		<comments>http://ocaoimh.ie/2007/09/05/is-your-eaccelerator-cache-dir-still-there/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 15:25:51 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[eaccelerator]]></category>
		<category><![CDATA[irishblogs]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2007/09/05/is-your-eaccelerator-cache-dir-still-there/</guid>
		<description><![CDATA[While looking through this WordPress performance post I realised that eAccelerator might not be running properly on this blog. For some time I&#8217;ve noticed this site hasn&#8217;t been as quick off the mark as it used to be. Dare I say it, but it was even a little sluggish! If you&#8217;re not familiar with it, [...]]]></description>
			<content:encoded><![CDATA[<p>While looking through this <a href="http://segala.com/blog/blog-tips3-increase-performance-of-your-wp-site/">WordPress performance post</a> I realised that <a href="http://eaccelerator.net/">eAccelerator</a> might not be running properly on this blog. For some time I&#8217;ve noticed this site hasn&#8217;t been as quick off the mark as it used to be. Dare I say it, but it was even a little sluggish!</p>
<p>If you&#8217;re not familiar with it, eAccelerator is a PHP accelerator. It caches PHP bytecode and performs optimizations to make your PHP site run a lot faster.</p>
<p>I verified that eAccelerator was loaded and then checked my php.ini configuration. Sure enough, the <code>eaccelerator.cache_dir</code> directive was set to &#8220;/tmp/eacc/&#8221; and that directory was deleted the last time my server rebooted.</p>
<p>A permanent fix is to change the location of the cache dir. Put it anywhere the webserver can read, but don&#8217;t put it in /tmp/.</p>
<p>While you&#8217;re looking at eAccelerator, upgrade to the latest version, especially if you&#8217;re running PHP5.</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89493287" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2005/03/16/lighttpd-fastcgi-php-and-eaccelerator/" rel="bookmark" title="Permanent Link: Lighttpd, fastcgi, php and eAccelerator">Lighttpd, fastcgi, php and eAccelerator</a></li><li> <a href="http://ocaoimh.ie/2007/11/07/how-well-did-super-cache-handle-the-digg/" rel="bookmark" title="Permanent Link: How well did Super Cache handle the digg?">How well did Super Cache handle the digg?</a></li><li> <a href="http://ocaoimh.ie/2009/01/09/wp-super-cache-087/" rel="bookmark" title="Permanent Link: WP Super Cache 0.8.7">WP Super Cache 0.8.7</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2007/09/05/is-your-eaccelerator-cache-dir-still-there/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Notes when upgrading to PHP5</title>
		<link>http://ocaoimh.ie/2007/08/18/notes-when-upgrading-to-php5/</link>
		<comments>http://ocaoimh.ie/2007/08/18/notes-when-upgrading-to-php5/#comments</comments>
		<pubDate>Sat, 18 Aug 2007 10:32:44 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[click-tracker]]></category>
		<category><![CDATA[crazyegg]]></category>
		<category><![CDATA[heatmap]]></category>
		<category><![CDATA[irishblogs]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2007/08/18/notes-when-upgrading-to-php5/</guid>
		<description><![CDATA[I upgraded one of my servers to PHP5 this morning. Two things to watch out for: The location of your php.ini may have changed. It&#8217;s probably now in /etc/php5/apache2/. You need to copy over any changes from your old one. Update your libraries too such as the mysql client and the gd library. Don&#8217;t forget [...]]]></description>
			<content:encoded><![CDATA[<p>I upgraded one of my servers to PHP5 this morning. Two things to watch out for:
<ul>
<li> The location of your php.ini may have changed. It&#8217;s probably now in /etc/php5/apache2/. You need to copy over any changes from your old one.</li>
<li> Update your libraries too such as the mysql client and the gd library. Don&#8217;t forget you can delete the old ones. <code>apt-get install php5-mysql php5-gd</code> will do the job of installing, the old packages have a php4 prefix.</li>
<li> WP-Cache doesn&#8217;t like PHP5 much. If you see a blank page after upgrading to PHP5, then hit reload and it loads, then WP-Cache needs to be modified. Leroy has the <a href="http://www.bloggingblog.net/wp-cache-and-the-blank-page-problem/">fix</a>, open wp-cache-phase2.php in your wp-cache folder and change <code>ob_end_clean()</code><code> to </code><code>ob_end_flush()</code>. SImple as that!</li>
</ul>
<p>The reason for the upgrade? I wanted to install the gd extension, but after lots of fun upgrading everything my browser tried to <a href="http://ocaoimh.ie/2005/04/14/debian-sarge-php4-and-apache2-why-do-you-persecute-me">download every page</a>, complaining that it was a phtml file. I chose the upgrade to PHP5 to fix it!</p>
<p>And finally, the reason for gd, was to get the heatmap in this <a href="http://workshop.davors.eu/wp-click-tracking/">wordpress click tracking</a> plugin working. It&#8217;s like <a href="http://crazyegg.com/">Crazy Egg</a> and it works well, but I couldn&#8217;t get it to display a heatmap for any page other than the front page. Some of the comments on <a href="http://www.dailyblogtips.com/wordpress-click-tracking-plugin/">Daily Blog Tips</a> where I found it are hilarious. They completely miss the point of using a heatmap!</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89493268" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2003/04/23/phppatterns-updates/" rel="bookmark" title="Permanent Link: phpPatterns() Updates">phpPatterns() Updates</a></li><li> <a href="http://ocaoimh.ie/2003/02/27/a-look-at-php5/" rel="bookmark" title="Permanent Link: A Look at PHP5">A Look at PHP5</a></li><li> <a href="http://ocaoimh.ie/2005/02/18/php-future-java-or-simplicity/" rel="bookmark" title="Permanent Link: PHP Future &#8211; Java or Simplicity">PHP Future &#8211; Java or Simplicity</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2007/08/18/notes-when-upgrading-to-php5/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Cannot load mysql extension. Please check your PHP configuration.</title>
		<link>http://ocaoimh.ie/2007/01/03/cannot-load-mysql-extension-please-check-your-php-configuration/</link>
		<comments>http://ocaoimh.ie/2007/01/03/cannot-load-mysql-extension-please-check-your-php-configuration/#comments</comments>
		<pubDate>Wed, 03 Jan 2007 14:37:21 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[irishblogs]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2007/01/03/cannot-load-mysql-extension-please-check-your-php-configuration/</guid>
		<description><![CDATA[A friend recently had a problem configuring a new server. He installed PHP, Apache, MySQL and phpMyAdmin but when he launched it he got the following error: phpMyAdmin – Error Cannot load mysql extension. Please check your PHP configuration. If you&#8217;ve installed all of the above more than once you&#8217;ll know what is more than [...]]]></description>
			<content:encoded><![CDATA[<p>A friend recently had a problem configuring a new server. He installed PHP, Apache, MySQL and phpMyAdmin but when he launched it he got the following error:</p>
<blockquote><p>phpMyAdmin – Error<br />
Cannot load mysql extension. Please check your PHP configuration.</p></blockquote>
<p>If you&#8217;ve installed all of the above more than once you&#8217;ll know what is more than likely wrong. The MySQL PHP module isn&#8217;t loaded. First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the <code>phpinfo();</code> command it will tell you where it is. Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini</p>
<p>Edit your server&#8217;s php.ini and look for the following line. Remove the &#8216;;&#8217; from the start of the line and restart Apache. Things should work fine now!</p>
<blockquote><p>;extension=mysql.so</p></blockquote>
<p>should become</p>
<blockquote><p>extension=mysql.so</p></blockquote>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89492982" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2002/07/26/mysql-optimization-b/" rel="bookmark" title="Permanent Link: MySQL Optimization by Jeremy Z &#8230;">MySQL Optimization by Jeremy Z &#8230;</a></li><li> <a href="http://ocaoimh.ie/2004/02/11/obscure-firefox-references-and-features/" rel="bookmark" title="Permanent Link: Obscure Firefox References and Features">Obscure Firefox References and Features</a></li><li> <a href="http://ocaoimh.ie/2004/08/24/searching-with-php-and-mysql/" rel="bookmark" title="Permanent Link: Searching with PHP and MySQL">Searching with PHP and MySQL</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2007/01/03/cannot-load-mysql-extension-please-check-your-php-configuration/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>Killing off PHP</title>
		<link>http://ocaoimh.ie/2006/10/01/killing-off-php/</link>
		<comments>http://ocaoimh.ie/2006/10/01/killing-off-php/#comments</comments>
		<pubDate>Sun, 01 Oct 2006 14:42:26 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[kill]]></category>
		<category><![CDATA[litespeed-tech]]></category>
		<category><![CDATA[lsphp]]></category>
		<category><![CDATA[lsws]]></category>
		<category><![CDATA[responding]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2006/10/01/killing-off-php/</guid>
		<description><![CDATA[Do you know why Apache processes get stuck and stop responding when serving pages on a WordPress site? I&#8217;ve seen this happen here and on my previous host on a regular basis. I don&#8217;t know what happens. It can&#8217;t be a PHP script gone into an infinite loop because the normal Apache timeout should kill [...]]]></description>
			<content:encoded><![CDATA[<p>Do you know why Apache processes get stuck and stop responding when serving pages on a WordPress site?
</p>
<p>I&#8217;ve seen this happen here and on my previous host on a regular basis. I don&#8217;t know what happens. It can&#8217;t be a PHP script gone into an infinite loop because the normal Apache timeout should kill it. It&#8217;s not MySQL as a quick inspection of the process list usually shows it&#8217;s empty.</p>
<p>It could be plugins, some of them haven&#8217;t been written to the high standards that is expected in WordPress core. It could be some strange interaction between plugins and core code and memory limits and PHP extensions.</p>
<p>Whatever causes it, this will fix it. It&#8217;s brutal, it&#8217;s crude, but it&#8217;ll stop the load average going up on your box and it will ensure that every Apache child process is listening and responding. Add this to the crontab of your nobody or www-data user. Pick whichever user runs the webserver because you want to limit the damage in case something bad happens and the command malfunctions!<br />
<code>*/10 * * * * ps auxw|grep apache2| awk '$10 !~ /0:00/ {print $2":"$10}'|awk -F ':' '$2 !~ 0 {print $1}'|xargs kill -9 2&gt; /dev/null </code><br />
What this does is it uses the ps, grep, and awk tools to find processes that are using anything more than the minimum CPU time. It is very crude, but it works.</p>
<p>If you use Litespeed, then replace &#8220;apache2&#8243; with &#8220;lsphp&#8221;. I have found that this is very necessary as those processes get stuck quite often, especially in low memory situations.</p>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89492859" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2010/08/26/so-someone-is-trying-to-reach-level-70-i/" rel="bookmark" title="Permanent Link: So someone is trying to reach level 70 i&#8230;">So someone is trying to reach level 70 i&#8230;</a></li><li> <a href="http://ocaoimh.ie/2010/08/17/its-sad-when-you-join-a-game-of-conque/" rel="bookmark" title="Permanent Link: It&#8217;s sad when you join a game of Conque&#8230;">It&#8217;s sad when you join a game of Conque&#8230;</a></li><li> <a href="http://ocaoimh.ie/2010/11/25/mileys-killing-spree/" rel="bookmark" title="Permanent Link: Miley&#8217;s killing spree">Miley&#8217;s killing spree</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2006/10/01/killing-off-php/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Simple UTW Performance Boost</title>
		<link>http://ocaoimh.ie/2006/09/27/simple-utw-performance-boost/</link>
		<comments>http://ocaoimh.ie/2006/09/27/simple-utw-performance-boost/#comments</comments>
		<pubDate>Wed, 27 Sep 2006 20:33:49 +0000</pubDate>
		<dc:creator>Donncha O Caoimh</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[christine-davis]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[ultimate-tag-warrior]]></category>
		<category><![CDATA[utw]]></category>

		<guid isPermaLink="false">http://ocaoimh.ie/2006/09/27/simple-utw-performance-boost/</guid>
		<description><![CDATA[The Ultimate Tag Warrior plugin for WordPress is a great plugin. It does the job of handling tags rather well. I&#8217;ve noticed many hits from Google searches that go to a tag page instead of a category page of the same name so there&#8217;s something there that Google likes. I love it! Christine Davis did [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.neato.co.nz/ultimate-tag-warrior/">Ultimate Tag Warrior plugin</a> for WordPress is a great plugin. It does the job of handling tags rather well. I&#8217;ve noticed many hits from Google searches that go to a tag page instead of a category page of the same name so there&#8217;s something there that Google likes. I love it! Christine Davis did a super job filling a niche with the &#8220;ultimate&#8221; tool that anyone could want.<br />
Unfortunately what isn&#8217;t so good is what goes on behind the scenes:</p>
<ol>
<li>UTW ignores your default category when saving your posts. Why ignore the default category when that is probably the subject you care most about? On my photoblog, <a href="http://inphotos.org/">In Photos.org</a> my default category is &#8220;photos&#8221; and I certainly want people to find my images.</li>
<li>UTW does an expensive SQL JOIN when it can&#8217;t find any tags for a post. Remember what I said about the default category? If you primarily post to your default category then every time someone sends you a request your server will get bogged down trying to find a non-existant record. It&#8217;s really bad when you have several years of posts and thousands of records in there.</li>
<li>If you&#8217;re not going to use the fancy AJAX tag search then don&#8217;t load the associated Javascript. It saves an extra request on the first page load, and the browser doesn&#8217;t have to process the file.</li>
</ol>
<p>Here is a patch that addresses those issues. It needs to be edited before you use it because you have to add a default tag. Here&#8217;s how to install it:</p>
<ol>
<li>Decide on a useful default tag. For this blog I use &#8220;holy-shmoly&#8221;. Open your WordPress database with phpmyadmin and look in wp_post2tag (the name may be different depending on your prefix). If you have already used the tag then find it and note down the tag_id of that tag. Otherwise, add your tag and note the new tag_id.</li>
<li>Edit utw-patch.diff and look for the strings DEFAULT_TAG_NAME and DEFAULT_TAG_ID and replace with the name and id you picked out in the last step.</li>
<li>To apply the patch, copy it into your wp-content/plugins/UltimateTagWarrior/ directory and run the following command.<br />
<blockquote><p>patch -p0 &lt; utw-patch.diff</p></blockquote>
</li>
<li>If you don&#8217;t have access to patch, then open utw-patch.diff in your favourite editor and make as much sense of it as you can. It&#8217;s not hard once you have the source files open as well.</li>
</ol>
<p>I&#8217;ve noticed a significant drop in server spikes since I made those changes. It takes a while for the default tag to be populated as it&#8217;s done when posts are visited but once it&#8217;s finished you should see a marked improvement. Oh, and install <a href="http://mnm.uib.es/gallir/wp-cache-2/">WP-Cache 2.0</a> as well. That&#8217;ll help you ride out the occasional digg!</p>
<p>Download the patch: <a href="http://ocaoimh.ie/wp-content/uploads/2006/09/utw-patch.diff">utw-patch.diff</a> for UTW 3.14159 for WordPress 2.0</p>
<p>By request, here are the modified files. Rename .txt to .php and copy them into your plugins/UltimateTagWarrior/ directory, overwrite the originals:</p>
<ol>
<li><a href="http://ocaoimh.ie/wp-content/uploads/2006/09/ultimate-tag-warrior-actions-wordpress2.txt">ultimate-tag-warrior-actions-wordpress2.txt</a></li>
<li><a href="http://ocaoimh.ie/wp-content/uploads/2006/09/ultimate-tag-warrior-actions.txt">ultimate-tag-warrior-actions.txt</a></li>
<li><a href="http://ocaoimh.ie/wp-content/uploads/2006/09/ultimate-tag-warrior-core.txt">ultimate-tag-warrior-core.txt</a></li>
</ol>
 <img src="http://ocaoimh.ie/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=89492852" width="1" height="1" style="display: none;" />
<p><strong>Related Posts</strong><ul><li> <a href="http://ocaoimh.ie/2002/01/16/mysql-increase-the/" rel="bookmark" title="Permanent Link: MySQL: Increase the table_cach &#8230;">MySQL: Increase the table_cach &#8230;</a></li><li> <a href="http://ocaoimh.ie/2006/10/26/brians-latest-comments-cached/" rel="bookmark" title="Permanent Link: Brians Latest Comments Cached">Brians Latest Comments Cached</a></li><li> <a href="http://ocaoimh.ie/2009/09/21/ubuntu-laptop-intel-graphics-speed-boost/" rel="bookmark" title="Permanent Link: Ubuntu? Laptop? Intel Graphics? Speed Boost!">Ubuntu? Laptop? Intel Graphics? Speed Boost!</a></li></ul></p>]]></content:encoded>
			<wfw:commentRss>http://ocaoimh.ie/2006/09/27/simple-utw-performance-boost/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

