<?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>Ian Dunn &#187; PHP</title>
	<atom:link href="http://iandunn.name/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://iandunn.name</link>
	<description>Seattle-based web developer blogging about tips and solutions</description>
	<lastBuildDate>Sat, 04 Feb 2012 00:22:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Unit Testing WordPress Plugins</title>
		<link>http://iandunn.name/unit-testing-wordpress-plugins/</link>
		<comments>http://iandunn.name/unit-testing-wordpress-plugins/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 01:38:08 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Standards and Best Practices]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Integration Testing]]></category>
		<category><![CDATA[MockPress]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Plugin Development]]></category>
		<category><![CDATA[Reflection]]></category>
		<category><![CDATA[SimpleTest]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=988</guid>
		<description><![CDATA[Nikolay Bachiyski gave a good talk at this year&#8217;s WordCamp San Francisco about <a title="Unit Testing Will Change Your Life" href="http://wordpress.tv/2011/08/20/nikolay-bachiyski-unit-testing-will-change-your-life/">unit testing WordPress plugins</a> . His method uses <a href="http://www.phpunit.de/manual/current/en/index.html">PHPUnit</a> , which is an additional PEAR package you have to install on the server. You can then use <a title="A series of mock functions to simulate WordPress for use with a unit testing framework" href="https://github.com/johnbintz/mockpress">MockPress</a> to simulate WordPress in the tests. Another option is the <a href="http://wordpress.org/extend/plugins/simpletest-for-wordpress/">SimpleTest for WordPress plugin</a> , which uses <a href="http://www.simpletest.org/">SimpleTest</a> instead of PHPUnit, doesn&#8217;t require installing a PEAR... [<a href="http://iandunn.name/unit-testing-wordpress-plugins/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>Nikolay Bachiyski gave a good talk at this year&#8217;s WordCamp San Francisco about <a title="Unit Testing Will Change Your Life" href="http://wordpress.tv/2011/08/20/nikolay-bachiyski-unit-testing-will-change-your-life/">unit testing WordPress plugins</a>. His method uses <a href="http://www.phpunit.de/manual/current/en/index.html">PHPUnit</a>, which is an additional PEAR package you have to install on the server. You can then use <a title="A series of mock functions to simulate WordPress for use with a unit testing framework" href="https://github.com/johnbintz/mockpress">MockPress</a> to simulate WordPress in the tests.</p>
<p>Another option is the <a href="http://wordpress.org/extend/plugins/simpletest-for-wordpress/">SimpleTest for WordPress plugin</a>, which uses <a href="http://www.simpletest.org/">SimpleTest</a> instead of PHPUnit, doesn&#8217;t require installing a PEAR package, and lets you run both unit and  integration tests.</p>
<p>Either way, you can use PHP&#8217;s ReflectionClass to <a title="Best practices to test protected methods with PHPUnit" href="http://stackoverflow.com/questions/249664/best-practices-to-test-protected-methods-with-phpunit">test private and protected methods</a>, although purists will tell you <a title="Do you test private [methods]?" href="http://stackoverflow.com/questions/105007/do-you-test-private-method">that&#8217;s not proper</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/unit-testing-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance Improvements for Dedicated WordPress Servers</title>
		<link>http://iandunn.name/performance-improvements-for-dedicated-wordpress-servers/</link>
		<comments>http://iandunn.name/performance-improvements-for-dedicated-wordpress-servers/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 20:45:14 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Benchmarks]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[PHP-APC]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=952</guid>
		<description><![CDATA[Mark Maunder <a title="The Basic WordPress Speedup" href="http://markmaunder.com/2011/the-basic-wordpress-speedup/">benchmarked several performance tuning measures</a> with a WordPress installation on a VPS server to show which are most effective. The biggest improvements were from installing <a href="http://php.net/manual/en/book.apc.php">PHP-APC</a> , setting up <a href="http://nginx.org/">Nginx</a> to proxy concurrent connections for Apache, and using MySQL&#8217;s query cache. &#160;]]></description>
			<content:encoded><![CDATA[<p>Mark Maunder <a title="The Basic WordPress Speedup" href="http://markmaunder.com/2011/the-basic-wordpress-speedup/">benchmarked several performance tuning measures</a> with a WordPress installation on a VPS server to show which are most effective. The biggest improvements were from installing <a href="http://php.net/manual/en/book.apc.php">PHP-APC</a>, setting up <a href="http://nginx.org/">Nginx</a> to proxy concurrent connections for Apache, and using MySQL&#8217;s query cache.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/performance-improvements-for-dedicated-wordpress-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse Error When Installing WordPress 3.2 on a PHP4 Server</title>
		<link>http://iandunn.name/parse-error-when-installing-wordpress-3-2-on-a-php4-server/</link>
		<comments>http://iandunn.name/parse-error-when-installing-wordpress-3-2-on-a-php4-server/#comments</comments>
		<pubDate>Fri, 20 May 2011 03:15:17 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[clone]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=857</guid>
		<description><![CDATA[This is the error you&#8217;ll get if you try to install WordPress 3.2 on a PHP4 server: Parse error: parse error, unexpected T_VARIABLE in /path/to/your/directory/wp-includes/load.php on line 566 It&#8217;s because <a href="http://acko.net/node/54">the clone keyword doesn&#8217;t exist in PHP4</a> .]]></description>
			<content:encoded><![CDATA[<p>This is the error you&#8217;ll get if you try to install WordPress 3.2 on a PHP4 server:</p>
<p style="padding-left: 30px;"><strong>Parse error</strong>:  parse error, unexpected T_VARIABLE in <strong>/path/to/your/directory/wp-includes/load.php</strong> on line <strong>566</strong></p>
<p>It&#8217;s because <a href="http://acko.net/node/54">the <em>clone</em> keyword doesn&#8217;t exist in PHP4</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/parse-error-when-installing-wordpress-3-2-on-a-php4-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Chained Properties Inside $wpdb-&gt;prepare()</title>
		<link>http://iandunn.name/using-chained-properties-inside-wpdb-prepare/</link>
		<comments>http://iandunn.name/using-chained-properties-inside-wpdb-prepare/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 23:23:30 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Curly Braces]]></category>
		<category><![CDATA[Prepare]]></category>
		<category><![CDATA[WPDB]]></category>

		<guid isPermaLink="false">http://iandunn.name/?p=701</guid>
		<description><![CDATA[If you&#8217;re using $wpdb-&#62;prepare() to query a custom table, you can&#8217;t pass the table name in as an argument because it will be single-quoted, which would be a MySQL syntax error. Instead, you need to insert the variable directly into the double-quoted query string and let PHP parse it out. That creates a new problem,... [<a href="http://iandunn.name/using-chained-properties-inside-wpdb-prepare/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using $wpdb-&gt;prepare() to query a custom table, you can&#8217;t pass the table name in as an argument because it will be single-quoted, which would be a MySQL syntax error. Instead, you need to insert the variable directly into the double-quoted query string and let PHP parse it out.</p>
<p>That creates a new problem, though, if the table name is stored in a chained property. PHP will only parse out the first level, so it&#8217;ll come out as something like <em>&#8220;database_name.Object ID #3-&gt;column_name&#8221;</em>. To fix that, you need to wrap the entire chain in curly braces, this like:</p>
<pre class="brush: php; title: ; notranslate">
$resultRows = $wpdb-&gt;get_results(
  $wpdb-&gt;prepare(
    &quot;SELECT result_id FROM `{$this-&gt;cfs-&gt;resultsTable}` WHERE user_id = %d&quot;,
    $user_id
  ), ARRAY_A
);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/using-chained-properties-inside-wpdb-prepare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a Blip.tv Thumbnail from the Embed URL</title>
		<link>http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/</link>
		<comments>http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 09:22:13 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Blip.tv]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=462</guid>
		<description><![CDATA[Here&#8217;s a function I wrote to get the thumbnail URL for a Blip.tv video when all you have is the embed URL. It can parse the embed URL out of a larger block of text (e.g., a blog post). It doesn&#8217;t use their API, which makes it easier to setup, but also means it might... [<a href="http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a function I wrote to get the thumbnail URL for a Blip.tv video when all you have is the embed URL. It can parse the embed URL out of a larger block of text (e.g., a blog post). It doesn&#8217;t use their API, which makes it easier to setup, but also means it might break in the future if they change things.</p>
<pre class="brush: php; title: ; notranslate">
/**
* Gets a Blip.tv video thumbnail URL when given a embed URL
* $author Ian Dunn
* @param string $embedURL e.g., http://blip.tv/play/hZBPgqbXeQA
* @param string $parse If equal to 'parse' then we'll try to parse the URL out of a larger block of text (like a post's $content), otherwise we'll assume it's the exact URL
* @return mixed If successful, the URL string e.g., http://a.images.blip.tv/Brandon-bgintro7369.jpg. If unsuccessful, boolean false
*/
function getBlipThumbnail($embedURL, $parse = '')
{
	$urlStart = strpos($embedURL, 'blip.tv/play/');
	if($urlStart === false)
		return false;

	// Parse out the embed URL if needed
	if($parse == 'parse')
	{
		$substrLength = strpos($embedURL, '&quot;', $urlStart) - $urlStart;
		$embedURL = 'http://' . substr($embedURL, $urlStart, $substrLength);
	}

	// Open the redirect page
	$handler = curl_init();
	curl_setopt($handler, CURLOPT_URL, $embedURL);
	curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1);
	$redirectPage = curl_exec($handler);
	curl_close($handler);

	// Parse out the ID
	$urlStart = strpos($redirectPage, '?file=');
	$substrLength = strpos($redirectPage, '&amp;', $urlStart) - $urlStart;
	$redirectURL = substr($redirectPage, $urlStart, $substrLength);
	$id = substr($redirectURL, strrpos($redirectURL, '%2F') + 3);

	// Get video details
	$handler = curl_init();
	curl_setopt($handler, CURLOPT_URL, 'http://blip.tv/rss/'. $id);
	curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1);
	$videoRSS = curl_exec($handler);
	curl_close($handler);

	// Parse out the thumbnail URL
	$urlStart = strpos($videoRSS, '');

	if($urlStart !== false)
	{
		$substrLength = strpos($videoRSS, '', $urlStart) - $urlStart;
		$thumbnailURL = substr($videoRSS, $urlStart + 21, $substrLength - 21);
	}
	else
	{
		$urlStart = strpos($videoRSS, 'media:thumbnail url=&quot;');

		if($urlStart !== false)
		{
			$substrLength = strpos($videoRSS, '&quot;/&gt;', $urlStart) - $urlStart;
			$thumbnailURL = substr($videoRSS, $urlStart + 21, $substrLength - 21);
		}
		else
			return false;
	}

	return $thumbnailURL;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/getting-a-blip-tv-thumbnail-from-the-embed-url/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Error Logs with Virtuozzo</title>
		<link>http://iandunn.name/php-error-logs-with-virtuozzo/</link>
		<comments>http://iandunn.name/php-error-logs-with-virtuozzo/#comments</comments>
		<pubDate>Mon, 10 May 2010 19:26:03 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[OpenVZ / Virtuozzo / Plesk]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Logging]]></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... [<a href="http://iandunn.name/php-error-logs-with-virtuozzo/">more</a>]]]></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 class="brush: plain; title: ; notranslate">
&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 class="brush: bash; title: ; notranslate">
  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 class="brush: bash; title: ; notranslate">
  /usr/local/psa/admin/sbin/websrvmng -a
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/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/natural-sorting-for-mysql/</link>
		<comments>http://iandunn.name/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 <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 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... [<a href="http://iandunn.name/natural-sorting-for-mysql/">more</a>]]]></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/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/passing-dates-and-times-between-php-and-mysql/</link>
		<comments>http://iandunn.name/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 <a href="http://www.bigroom.co.uk/blog/dates-in-php-and-mysql">handling dates and times with PHP and MySQL</a> .]]></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/passing-dates-and-times-between-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing cforms Data Directly</title>
		<link>http://iandunn.name/accessing-cforms-data-directly/</link>
		<comments>http://iandunn.name/accessing-cforms-data-directly/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 19:04:36 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[cforms]]></category>
		<category><![CDATA[Plugin Development]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=114</guid>
		<description><![CDATA[I&#8217;m using the <a href="http://www.deliciousdays.com/cforms-plugin">cforms</a> plugin on one site at the client&#8217;s request, and I needed to access some of the form&#8217;s data. Their API didn&#8217;t have what I needed, so I thought I&#8217;d just query the database directly. But when I looked at the database I didn&#8217;t see any tables for it. I thought that was... [<a href="http://iandunn.name/accessing-cforms-data-directly/">more</a>]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using the <a href="http://www.deliciousdays.com/cforms-plugin">cforms</a> plugin on one site at the client&#8217;s request, and I needed to access some of the form&#8217;s data. Their API didn&#8217;t have what I needed, so I thought I&#8217;d just query the database directly. But when I looked at the database I didn&#8217;t see any tables for it. I thought that was kind of odd, but figured maybe they just used a bunch of wp_options fields, but I didn&#8217;t notice anything when I skimmed through the table. Then I thought maybe they were writing out to an XML file, so I looked through the file system, but found nothing. Kind of frustrated, I started skimming through the code to try and figure out where hell it was storing it&#8217;s data. I Didn&#8217;t find anything solid, so I searched their forums and on Google, and found nothing.</p>
<p>I came back a few days later and skimmed through the code again and eventually figured out that it <em>was</em> using the wp_options table, but only one field. All of the global settings, form settings and form data are stored in a single field, in a serialized format that only an MIT grad on crack could parse by hand.</p>
<p>I added a post to their forums to help anyone else in my position, and also to mention that maybe their approach wasn&#8217;t the most intuitive, organized or standard. After a couple of days I checked back to see if anyone had left any comments on it, but it was gone. Lame&#8230; How petty and insecure do you have to be to censor criticism?</p>
<p>So anyway, in the end all you really need to do is use get_option() to get an associative array of all of the data.</p>
<pre class="brush: php; title: ; notranslate">
$cforms = get_option('cforms_settings'); // get the data
echo '&lt;pre&gt;'. print_r($cforms, true) .'&lt;/pre&gt;'; // output in readable format
</pre>
<p><strong><br />
Update: </strong>Ok, so this is really more a case of me being behind the curve on WP plugin development. Using serialized options is the standard now.</p>
]]></content:encoded>
			<wfw:commentRss>http://iandunn.name/accessing-cforms-data-directly/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing the Oracle Library for PHP</title>
		<link>http://iandunn.name/88/</link>
		<comments>http://iandunn.name/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>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SELinux]]></category>

		<guid isPermaLink="false">http://iandunn.name/workblog/?p=88</guid>
		<description><![CDATA[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... [<a href="http://iandunn.name/88/">more</a>]]]></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 class="brush: php; title: ; notranslate">
oci_connect('username', 'password', '127.0.0.1:1521/dbname');
</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/88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

