<?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>workblog &#187; PHP</title>
	<atom:link href="http://iandunn.name/workblog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://iandunn.name/workblog</link>
	<description></description>
	<lastBuildDate>Thu, 09 Sep 2010 17:53:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Error Logs with Virtuozzo</title>
		<link>http://iandunn.name/workblog/php-error-logs-with-virtuozzo/</link>
		<comments>http://iandunn.name/workblog/php-error-logs-with-virtuozzo/#comments</comments>
		<pubDate>Mon, 10 May 2010 19:26:03 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Virtuozzo/Plesk]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=278</guid>
		<description><![CDATA[Virtuozzo sets domains up to have PHP&#8217;s display_errors flag turned off by default, so that you&#8217;ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you&#8217;re trying to debug something.
Instead of displaying the [...]]]></description>
			<content:encoded><![CDATA[<p>Virtuozzo sets domains up to have PHP&#8217;s display_errors flag turned off by default, so that you&#8217;ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you&#8217;re trying to debug something.</p>
<p>Instead of displaying the errors, you can configure PHP to log them and then use the logs for debugging. For a Linux environment, you&#8217;ll need to create a file named vhost.conf inside the domain&#8217;s conf directory, <em>/var/www/vhosts/domain.name/conf</em>.</p>
<pre name="code" class="css">

&lt;Directory /var/www/vhosts/domain.name&gt;
php_value error_log /var/www/vhosts/domain.name/statistics/logs/php-errors.log
php_flag display_errors off
php_value error_reporting 6143
php_flag log_errors on
&lt;/Directory&gt;
</pre>
<p>Then create the file and assign it the right permissions</p>
<pre name="code" class="css">

cd /var/www/vhosts/domain.name/statistics/logs/
touch php-errors.log
chown apache php-errors.log
</pre>
<p>And the last thing is to tell Apache to reread the updated conf file</p>
<pre name="code" class="css">

/usr/local/psa/admin/sbin/websrvmng -a
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/workblog/php-error-logs-with-virtuozzo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Natural Sorting for MySQL</title>
		<link>http://iandunn.name/workblog/natural-sorting-for-mysql/</link>
		<comments>http://iandunn.name/workblog/natural-sorting-for-mysql/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 16:38:02 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=242</guid>
		<description><![CDATA[MySQL doesn&#8217;t provide a way to perform natural sorting on a string, so if you have numbers in your data you may get results like this
Product 110
Product 120
Product 13
Product 140
There are a lot of hacks available, but all of the ones I&#8217;ve seen only work in specific circumstances. The only comprehensive solution I found to [...]]]></description>
			<content:encoded><![CDATA[<p>MySQL doesn&#8217;t provide a way to perform <a href="http://sourcefrog.net/projects/natsort/">natural sorting</a> on a string, so if you have numbers in your data you may get results like this</p>
<p style="padding-left: 30px;">Product 110<br />
Product 120<br />
Product 13<br />
Product 140</p>
<p>There are a lot of hacks available, but all of the ones I&#8217;ve seen only work in specific circumstances. The only comprehensive solution I found to do the sorting in MySQL is <a href="http://drupal.org/project/natsort">Drupal&#8217;s natsort module</a>. You don&#8217;t need to be running Drupal to use it, just issue the queries that create the function and it&#8217;s dependencies, and you can then call it in your regular queries. But, it requires MySQL 5, so if you&#8217;re working on an older server and your data doesn&#8217;t work with one of the hacks, then you&#8217;ll probably just have to do the natural sorting in your scripting language, using something like <a href="http://us2.php.net/manual/en/function.natsort.php">PHP&#8217;s natsort()</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/workblog/natural-sorting-for-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing dates and times between PHP and MySQL</title>
		<link>http://iandunn.name/workblog/passing-dates-and-times-between-php-and-mysql/</link>
		<comments>http://iandunn.name/workblog/passing-dates-and-times-between-php-and-mysql/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 21:59:35 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=125</guid>
		<description><![CDATA[Richard Lord wrote a good article explaining the various ways of handling dates and times with PHP and MySQL.
]]></description>
			<content:encoded><![CDATA[<p>Richard Lord wrote a good article explaining the various ways of <a href="http://www.bigroom.co.uk/blog/dates-in-php-and-mysql">handling dates and times with PHP and MySQL</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/workblog/passing-dates-and-times-between-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing the Oracle Library for PHP</title>
		<link>http://iandunn.name/workblog/88/</link>
		<comments>http://iandunn.name/workblog/88/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 17:36:59 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=88</guid>
		<description><![CDATA[Chris Sibert wrote a good tutorial on installing the Oracle library for PHP. If you&#8217;re running SELinux, I&#8217;d recommend temporarily turning it off to get the module setup so you don&#8217;t have to worry about problems during the install, and then turn SELinux back on after you verify the module is working. Then you can [...]]]></description>
			<content:encoded><![CDATA[<p>Chris Sibert wrote a good tutorial on <a href="http://www.chrissibert.com/blog/2008/06/18/compiling-an-oracle-instant-client-oci8-php-module-in-rhel-51/">installing the Oracle library for PHP</a>. If you&#8217;re running SELinux, I&#8217;d recommend temporarily <a href="http://www.crypt.gen.nz/selinux/disable_selinux.html">turning it off</a> to get the module setup so you don&#8217;t have to worry about problems during the install, and then turn SELinux back on after you verify the module is working. Then you can update SELinux&#8217;s policy to allow Apache and PHP to do everything they need to do.</p>
<p>After you&#8217;ve got the module working working you can just put the database server&#8217;s hostname and port in the db parameter of oci_connect(), rather than messing with a tnsnames.ora file.</p>
<pre name="code" class="php">

oci_connect(&#039;username&#039;, &#039;password&#039;, &#039;127.0.0.1:1521/dbname&#039;);
</pre>
<p><strong>Update: </strong><a href="http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf">The Underground PHP and Oracle Manual</a> has a lot of information on installation, and also a good section on tuning. oci_pconnect() can be used to create a persistent connection to the database server, rather than creating a new one during each script instance.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/workblog/88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Home page posts missing when using Pretty Permalinks for Wordpress on IIS</title>
		<link>http://iandunn.name/workblog/12/</link>
		<comments>http://iandunn.name/workblog/12/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 19:12:47 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=12</guid>
		<description><![CDATA[I&#8217;ve been working on a problem recently with the Pretty Permalinks solution for Wordpress on IIS. I was migrating a working Wordpress blog from one server to another and once it was on the new server the front page would come up w/ the theme, but instead of the default posts it would say &#8220;Sorry, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a problem recently with the <a href="http://tech.einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/">Pretty Permalinks</a> solution for Wordpress on IIS. I was migrating a working Wordpress blog from one server to another and once it was on the new server the front page would come up w/ the theme, but instead of the default posts it would say &#8220;Sorry, no posts matched your criteria.&#8221; If I reverted to the default ?p=id permalinks everything worked fine, but not with /%postname%. With the %postname% permalinks, any sub pages would work, just not http://example.com/blog. http://example.com/blog/index.php would work, though. I think the problem is because <a href="http://tech.einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/#comment-21686">the site was using PHP&#8217;s ISAPI module instead of FastCGI</a>. The server I was moving to only had CGI and ISAPI, so instead of using FastCGI I just created a /blog/index.html and set IIS to redirect it to http://example.com/blog/index.php</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/workblog/12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blank Page when using IIS Permalink hack</title>
		<link>http://iandunn.name/workblog/blank-page-when-using-iis-permalink-hack/</link>
		<comments>http://iandunn.name/workblog/blank-page-when-using-iis-permalink-hack/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 17:44:13 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=5</guid>
		<description><![CDATA[I use Pretty Wordpress Permalinks on IIS when I need to install WP on a windows server, but on one host I ran into a problem where I would get a blank page if the post didn&#8217;t exist instead of the theme&#8217;s 404 template. But for some reason it works fine if I just echo [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://tech.einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/">Pretty Wordpress Permalinks on IIS</a> when I need to install WP on a windows server, but on one host I ran into a problem where I would get a blank page if the post didn&#8217;t exist instead of the theme&#8217;s 404 template. But for some reason it works fine if I just echo something in wp-404-handler.php. I echoed out an HTML comment so it wouldn&#8217;t disturb the layout. Here&#8217;s my new version of the file:</p>
<pre name="code" class="php">

&lt;?php
	echo &quot;&lt;!-- If the page doesn&#039;t exist I get a blank screen unless I echo something --&gt;&quot;;
	$qs = $_SERVER[&#039;QUERY_STRING&#039;];
	$_SERVER[&#039;PATH_INFO&#039;] = $_SERVER[&#039;REQUEST_URI&#039;] = substr($qs, strpos($qs, &#039;:80&#039;)+3);
	require_once(&#039;index.php&#039;);
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/workblog/blank-page-when-using-iis-permalink-hack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
