<?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>Casey A. McLaughlin &#187; codeigniter</title>
	<atom:link href="http://www.caseymclaughlin.com/tags/codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.caseymclaughlin.com</link>
	<description>Online Portfolio</description>
	<lastBuildDate>Mon, 08 Mar 2010 21:38:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CodeIgniter Preflight Checker</title>
		<link>http://www.caseymclaughlin.com/2009/06/codeigniter-preflight-checker/</link>
		<comments>http://www.caseymclaughlin.com/2009/06/codeigniter-preflight-checker/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 18:16:07 +0000</pubDate>
		<dc:creator>McLaughlin Casey</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[portability]]></category>
		<category><![CDATA[portable]]></category>

		<guid isPermaLink="false">http://www.caseymclaughlin.com/?p=84</guid>
		<description><![CDATA[This post builds on last week's discussion of how to make an application portable by demonstrating how to implement a "pre-flight" check before your application runs.]]></description>
			<content:encoded><![CDATA[		<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=CodeIgniter Preflight Checker&amp;rft.aulast=McLaughlin&amp;rft.aufirst=Casey&amp;rft.subject=Web Development&amp;rft.source=Casey A. McLaughlin&amp;rft.date=2009-06-26&amp;rft.type=&amp;rft.format=text&amp;rft.identifier=http://www.caseymclaughlin.com/2009/06/codeigniter-preflight-checker/&amp;rft.language=English"></span>
<p><a href="http://www.flickr.com/photos/mike_miley/2996159793/"><img class="alignright size-thumbnail wp-image-86" title="preflight_check" src="http://www.caseymclaughlin.com/wp-content/uploads/2009/06/preflight_check-150x150.jpg" alt="preflight_check" width="150" height="150" /></a>In <a title="Last Post: Making PHP Applications Portable" href="http://www.caseymclaughlin.com/2009/06/making-php-applications-portable/">my last post</a>, I discussed do&#8217;s and don&#8217;ts for making a PHP application portable.  This week, I will show you how to create a preflight checker in the <a title="CodeIgniter Homepage" href="http://www.codeigniter.com">CodeIgniter PHP framework</a> to ensure that an environment will support your application.</p>
<p><span id="more-84"></span></p>
<p><em>Note: This article assumes that you already have a working CodeIgniter application setup.  If you are interested in getting started with CodeIgniter, there are some <a title="CodeIgniter Video Tutorials" href="http://codeigniter.com/tutorials/">really</a> <a title="CodeIgniter Official User Guide" href="http://codeigniter.com/user_guide/">great</a> <a title="Net Tuts &quot;Getting started with CodeIgniter&quot; Article" href="http://net.tutsplus.com/videos/screencasts/easy-development-with-codeigniter/">tutorials </a>on the web.  If you&#8217;re not using CodeIgniter, skip to the &#8220;What to Check&#8221; section below for a general idea of how to apply this to PHP apps in general.</em></p>
<h2>Setting up the Hook</h2>
<p>The best way to setup a preflight checker is to create a hook.  Make sure that you <a title="CodeIgniter Hooks Documentation" href="http://codeigniter.com/user_guide/general/hooks.html">enable hooks</a> in your main configuration file before getting started.  We&#8217;ll be setting up a pre-system hook, so add the following code to your <em>application/config/hooks.php</em> file:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*Preflight Check Hook*/</span>
<span style="color: #000088;">$hook</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pre_system'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'function'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'preflight_check'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'filename'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'preflight_check_hook.php'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'filepath'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'hooks'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This will tell CodeIgniter to run this hook every time the system starts.  As you can infer from the above code, we&#8217;ll now have to create a file in the <em>application/hooks/</em> folder (if it doesn&#8217;t exist, create it) named <strong>preflight_check_hook.php</strong> and add a function to that file named <strong>preflight_check()</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Preflight Check checks all of the prerequistes before the first
 * pageview for each session.
 *
 * If a problem is found, the program halts execution.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> preflight_check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//all your checks go here</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now we&#8217;re ready to add checks so we can test the server environment.</p>
<h2>What to Check</h2>
<p>Technically, you can check whatever you want here, but I tend to check the things that are likely to be different from one server environment to the next.  Some of the more important ones are:</p>
<ul>
<li>Whether the version of PHP or CodeIgniter is new enough to support your application.  You can check this by using the <em>phpversion()</em> function</li>
<li>Necessary PHP Extensions installed?  You can check this by using the <em>function_exists()</em> function.</li>
<li>PHP.INI variables set correctly?  You can check this by using the <em>ini_get()<strong> </strong></em>function.</li>
<li>Whether certain folders are really writable on the server or not</li>
<li>Whether files exist or not.</li>
</ul>
<p>Of course, you can check for most anything you want to in the preflight check, and even try to tweak the environment a little using <em>ini_set()</em>.  What you <span style="text-decoration: underline;">can&#8217;t</span> do is access most of the functionality in CodeIgniter, since this hook will run before most of your libraries are loaded.  There are a few useful CodeIgniter variables and functions that you will have access to, though:</p>
<ul>
<li><em>show_error()</em> &#8212; For printing out errors (non CodeIgniter users should use the <em>die()</em> function)</li>
<li><em>is_really_writable()</em> &#8212; For testing if a file is writable or not (non CodeIgniter users should use the <em>is_readable()</em> function)</li>
<li><em>$application_folder </em>and <em>$system_folder</em></li>
</ul>
<p>Rather than bore you with lengthy explanations of each type of check, it will be easier to simply show you an example of how I typically do it.  Below is an example preflight check hook that I ripped almost verbatim from one of my applications:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> preflight_check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$application_folder</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$system_folder</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Ensure proper version of PHP</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">phpversion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000ff;">'5.1'</span><span style="color: #009900;">&#41;</span>
	  show_error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;This application requires at least PHP 5.1 to run properly!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Ensure SQLITE extension is installed</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql_connect'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	  show_error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The sqlite PHP extension is required to run this application!  Refer to &lt;a href=&quot;</span>http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//us.php.net/manual/en/book.sqlite.php&quot;&gt;the PHP documentation for this extension&lt;/a&gt; for more information.&quot;);</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Ensure GD2 is is installed</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;gd_info&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		show_error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The PHP GD2 image library is required to run this software.  Check with your server administrator or hosting provider, or &lt;a title=&quot;</span>Installation Instructions <span style="color: #b1b100;">for</span> GD2<span style="color: #339933;">&gt;</span>refer to the PHP documentation <span style="color: #b1b100;">for</span> installation instructions<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;.&amp;</span>quot<span style="color: #339933;">;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 	<span style="color: #666666; font-style: italic;">//Check if the system cache directory is writable 	if ( ! is_really_writable($system_folder . &quot; href=&quot;http://us2.php.net/manual/en/intro.image.php&quot;&gt;&lt;/a&gt;&lt;a title=&quot;JSON extension installation instructions&quot; href=&quot;http://us3.php.net/manual/en/book.json.php&quot;&gt;manually install it&lt;/a&gt;.)&quot;);</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Check memory limit and attempt to set it to what this application needs</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>get_bytes<span style="color: #009900;">&#40;</span><span style="color: #990000;">ini_get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php_value memory_limit'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">33554432</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php_value_memory_limit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'32m'</span><span style="color: #009900;">&#41;</span>
			show_error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The memory limit in your PHP.INI file must be set to at least 32 megabytes (32m).&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You can copy this code into your <em>application/hooks/preflight_check_hook.php</em> and try it out.  Basically, it will halt execution (via the <em>show_error()</em> function) and show an error on the screen that alerts the user to something not being setup correctly if any one of these checks fails.</p>
<h2>What&#8217;s the Advantage over just letting the program fail on its own?</h2>
<p>Technically, nothing; your preflight checker will check things that would normally cause your application to fail at some point in the execution anyway.  This is simply a way for you to alert your admins/developers/users that they need to fix their environment right off the bat.  Plus it&#8217;s more graceful and clean than PHP error messages.</p>
<p>Practically, however, this may save a lot of headaches, especially if you distribute the application or expect people to download a copy onto their own desktops for development.  Oh, and if your users/developers/admins have PHP error reporting turned off on their system, then a carefully coded preflight checker will save them from getting a mysterious blank screen when the environment doesn&#8217;t match the requirements.</p>
<h2>Keeping this thing from running for every page view</h2>
<p>You probably won&#8217;t want this script to run every time a  page is loaded on your site, especially if the script includes file operations, lest your server take a performance hit.  Typically, you will want to run this preflight checker only once per session.  By adding a few lines of code to the top and bottom of this function, you can make it run only once per session (unless it fails).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> preflight_check<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//See if this has already been run during the current session</span>
	<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'preflight_check_pass'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'preflight_check_pass'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$application_folder</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$system_folder</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Ensure proper version of PHP</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">phpversion</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #0000ff;">'5.1'</span><span style="color: #009900;">&#41;</span>
	  show_error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;This application requires at least PHP 5.1 to run properly!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// All of the</span>
	<span style="color: #666666; font-style: italic;">// rest of your checks</span>
	<span style="color: #666666; font-style: italic;">// go in here...</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// ...</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Woo hoo.. the check passed!</span>
	<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'preflight_check_pass'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'pass'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You&#8217;ll notice that this example uses PHP&#8217;s built-in session system rather than CodeIgniter&#8217;s session library.  This is because CodeIgniter&#8217;s will not have been loaded yet when this hook runs, and because we&#8217;re not storing any particularly sensitive information in this session, so we don&#8217;t have to take advantage of CI&#8217;s advanced session security features.</p>
<p>Well, that&#8217;s about it for now.  If you have any comments or see any issues with the examples in today&#8217;s post, feel free to share by leaving a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caseymclaughlin.com/2009/06/codeigniter-preflight-checker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Making PHP Applications Portable</title>
		<link>http://www.caseymclaughlin.com/2009/06/making-php-applications-portable/</link>
		<comments>http://www.caseymclaughlin.com/2009/06/making-php-applications-portable/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 19:27:27 +0000</pubDate>
		<dc:creator>McLaughlin Casey</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[portability]]></category>
		<category><![CDATA[portable]]></category>

		<guid isPermaLink="false">http://www.caseymclaughlin.com/?p=56</guid>
		<description><![CDATA[This post is the first in a two-part series explaining the virtues of portability when designing PHP applications, and provides a checklist of do's and don'ts (mostly don'ts) for ensuring that your application will run in any PHP server environment.]]></description>
			<content:encoded><![CDATA[		<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=Making PHP Applications Portable&amp;rft.aulast=McLaughlin&amp;rft.aufirst=Casey&amp;rft.subject=Web Development&amp;rft.source=Casey A. McLaughlin&amp;rft.date=2009-06-23&amp;rft.type=&amp;rft.format=text&amp;rft.identifier=http://www.caseymclaughlin.com/2009/06/making-php-applications-portable/&amp;rft.language=English"></span>
<p><img class="alignright size-full wp-image-62" title="portable_computer_guy" src="http://www.caseymclaughlin.com/wp-content/uploads/2009/06/portable_computer_guy.jpg" alt="portable_computer_guy" width="225" height="158" />&#8220;Portable&#8221; means that your application is able to run on any PHP webserver with minimal fuss.</p>
<p>Ensuring portability is an absolute must for programs that are packaged and distributed for public consumption, like WordPress or MediaWiki.  But, you should aim for portability in all of your applications.  The ideal is a one or two-step installation process and only two or three system requirements:  1. <em>Webserver (IIS/Apache/etc)</em>, 2. <em>PHP v5.X+</em>, 3. <em>MySQL 4+</em>.</p>
<p><span id="more-56"></span></p>
<h2>Why Make it Portable?</h2>
<p>For one, it keeps things simple.  The concept of portability meshes well with the <a title="Keep It Simple, Stupid." href="http://en.wikipedia.org/wiki/KISS_principle">KISS</a> concept that I value so highly.</p>
<p>Secondly, it makes deploying your application to a new server simple if the need ever arises.</p>
<p>Thirdly, it enables you to easily distribute your package to the world if that is your intention.  I, for one, simply hate installing web applications on my server with long lists of prerequisites and a lengthy install process, especially if one of those steps is to install <em>another</em> set of libraries (e.g. from PEAR) before installing the application itself.</p>
<p>Finally, portability makes distributed development easier.  Many applications are developed on Windows but run on Linux.  Portable applications eliminate the headaches involved in trying to get the to two environments (development &amp; production) to match.</p>
<h2>How to Make Your Application Portable</h2>
<p>A truly portable application will work out-of-the-box, and require minimal configuration.  It will also automatically check the environment for specific configuration or prerequisites that <em>do </em>happen to be required.  Below are five things to try and avoid, and one thing to try and do to ensure your application is portable:</p>
<h3>1. Don&#8217;t rely on exotic PHP extensions</h3>
<p>I&#8217;m talking about extensions that are not bundled with PHP or found pre-installed on most hosting providers.  If you do require a specific PHP extension that is not bundled with PHP, you should check for the existence of the extension at the beginning of the program&#8217;s execution.</p>
<p>For example, many of my applications require JSON libraries, which some versions of PHP5 do not include, so I check for the existence of the <em>json_encode</em> function when the application first runs.</p>
<h3>2. Don&#8217;t rely on separate installation of PEAR Libraries</h3>
<p>Don&#8217;t get me wrong; PEAR is great.  But, you shouldn&#8217;t predicate the successful execution of your application on your users installing external libraries.  Most PEAR libraries are dependent on other PEAR libraries, and require the user to figure out and install multiple packages.  Your application should not require this pre-setup, and it should run with all of the required libraries and classes included.</p>
<h3>3. Don&#8217;t rely on command-line configuration</h3>
<p>If you want your application to be truly portable, you have to cater to the crowd who has only FTP access to their servers.  Yes, these folks are few-and-far-between, but coding with them in mind ensures that your application setup procedure is as simple as possible.  This means that your installation instructions should be completely void of anything that says <em>&#8220;login to the command line and run xyz command&#8221;</em>.</p>
<p>Definitely don&#8217;t rely on the user to have administrative privileges on the server.  This means to try to avoide the necessity for external software or packages (although this is unavoidable sometimes).</p>
<h3>4. Don&#8217;t rely on the program to be run on a specific operating system</h3>
<p>This one is  a stretch for some people, but truly portable applications can run on Windows, Linux, or MAC servers without fuss.  I make all my applications portable enough to run on any OS  simply because we use SVN for development, which requires my developers to download fully working copies of the project to their desktops.  Since my developers use Windows &amp; Mac, and my servers run Linux, my applications have to be cross-platform compatible.</p>
<h3>5. Don&#8217;t rely on PHP.INI customizations</h3>
<p>A lot of PHP applications I have tried won&#8217;t work with magic quotes (or vice versa), or won&#8217;t work without the user increasing the amount of memory or upload file size  for PHP.   Before making these nice-to-have&#8217;s required, ask yourself if you can find a different way to solve the problem.</p>
<p>For situations where it is unavoidable to ensure that a specific directive is set, your application should automatically attempt to override the default PHP.INI customization via <em>ini_set() </em>and then inform the user in <span style="text-decoration: underline;">plain English</span> that the ini value needs to be changed.</p>
<h3>6. <span style="text-decoration: underline;">Do</span> include a mechanism in the application to test for required prerequisites at the very start of execution (or as part of the installation process)</h3>
<p>Rather than have your application spit out a generic PHP error message when it comes across an environment setting that it doesn&#8217;t like, you should include a function that performs a &#8220;pre-flight checklist&#8221; at the beginning of runtime for each session, or at least the very first time your application is run.</p>
<p>Next week, I will show you how to do exactly this by creating a hook in <a title="CodeIgniter Homepage" href="http://codeigniter.com">CodeIgniter</a> that thoroughly tests the environment, and informs the user how to remedy issues.</p>
<h6>For Further Reading, I recommend:</h6>
<ul>
<li><a title="&quot;Writing Portable PHP Code&quot; article" href="http://www.phpwact.org/php/writing_portable_php_code">Writing Portable PHP Code</a> from <a title="Web Application Toolkit" href="http://www.phpwact.org">PHPwact.org</a></li>
<li><a title="&quot;Making Your PHP Code Portable&quot; Article" href="http://www.mtdev.com/2002/09/make-your-php-code-portable">Making Your PHP Code Portable</a> from <a title="mtDev" href="http://mtdev.com">mtdev.com</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.caseymclaughlin.com/2009/06/making-php-applications-portable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
