<?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>Digging into WordPress &#187; errors</title>
	<atom:link href="http://digwp.com/tag/errors/feed/" rel="self" type="application/rss+xml" />
	<link>http://digwp.com</link>
	<description>Take your WordPress skills to the next level.</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:03:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Create a Custom Database Error Page in WordPress</title>
		<link>http://digwp.com/2009/11/custom-database-error-page/</link>
		<comments>http://digwp.com/2009/11/custom-database-error-page/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 19:12:46 +0000</pubDate>
		<dc:creator>Jeff Starr</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=992</guid>
		<description><![CDATA[As a dynamic blogging system, WordPress consists of PHP files (the WP core) that interact with a MySQL database to generate the web pages for your website. When everything is working properly, this dynamic interaction keeps WordPress humming along like a champ, but when your database crashes, WordPress can&#8217;t operate and will deliver the following [...]]]></description>
			<content:encoded><![CDATA[<p>As a dynamic blogging system, WordPress consists of <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> files (the WP core) that interact with a <acronym title="My Structured Query Language">MySQL</acronym> database to generate the web pages for your website. When everything is working properly, this dynamic interaction keeps WordPress humming along like a champ, but when your database crashes, WordPress can&rsquo;t operate and will deliver the following message to your visitors:</p>
<p><img src="http://digwp.com/wp-content/blog-images/database-error.gif" alt="[ Screenshot: Default WordPress Database Error Message ]" /></p>
<p>The question is, could this information help an attacker who has targeted your site? This type of specific information should be going to <strong>you</strong>, the site administrator &#8212; not announced to the entire world. Besides, that message really isn&rsquo;t helping anyone. To the average visitor, it just means the site is borked and that it&rsquo;s time to move on to someplace else. And to you, the site Admin, the default error message doesn&rsquo;t mean anything unless you&rsquo;re lucky enough to be sitting there looking at your site when it happens. I think it&rsquo;s safe to say that the default database error message:</p>
<ul>
<li>is ugly</li>
<li>is useless to visitors</li>
<li>is useless to site admins</li>
<li>reveals sensitive information</li>
</ul>
<p><span id="more-992"></span></p>
<p>Fortunately, we can improve on all these areas by creating and implementing <strong>our own</strong> custom database error page. In this article, you&rsquo;ll learn how to setup your own error page and add some server-side functionality that will improve your ability to respond to database problems as soon as they happen.</p>
<h3>How it works</h3>
<p>Basically, it all happens automatically: whenever WordPress is unable to connect to the database, it will check for the presence of your custom error page and then serve it up to your visitors; otherwise, if a custom error page is <strong>not</strong> present, the default error page is displayed. It&rsquo;s <em>that</em> simple.</p>
<h3>How to set it up</h3>
<p>To create your own database error page, simply create your custom page, name it &ldquo;<code>db-error.php</code>&rdquo;, and upload it to the <code>wp-content</code> directory like so:</p>
<pre><code>wp-content/db-error.php</code></pre>
<p>That&rsquo;s pretty much all there is to it. Most of the action happens behind the scenes depending on how you set things up. Because this is an actual <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> file, you can implement just about any non-database functionality, along with whatever markup and <acronym title="Cascading Style Sheets">CSS</acronym> you desire.</p>
<p>So, now that we know the dark secrets that make this work, let&rsquo;s look at an actual example..</p>
<h3>An actual example of a custom database error page</h3>
<p>Here is the code that I use at <a href="http://perishablepress.com/" title="Perishable Press: Digital Design and Dialogue">Perishable Press</a>:</p>
<pre><code>&lt;?php // custom WordPress database error page tutorial @ digwp.com

	header('HTTP/1.1 503 Service Temporarily Unavailable');
	header('Status: 503 Service Temporarily Unavailable');
	header('Retry-After: 3600'); // 1 hour = 3600 seconds
	mail("spamless@domain.tld", "Database Error", "There is a problem with teh database!", "From: Montgomery Scott");

?&gt;
&lt;!DOCTYPE HTML&gt;
&lt;html dir="ltr" lang="en-US"&gt;
	&lt;head&gt;
		&lt;title&gt;503 Service Temporarily Unavailable&lt;/title&gt;
		&lt;style type="text/css"&gt;
			h1, p {
				font-family: Helvetica, sans-serif;
				font-size: 24px;
				color: #333;
				}
			p {
				font-size: 14px;
				}
		&lt;/style&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;h1&gt;Captain, the ship can&amp;rsquo;t take much more of this!&lt;/h1&gt;
		&lt;p&gt;Perishable Press is currently experiencing technical issues &amp;mdash; Please check back soon!&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>Simple, yes, but more effective than the default error page at facilitating a rapid response. Again, because this is a regular <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> file, we can do just about anything with it &#8212; more functionality, elaborate design, etc. &#8212; but before we look at some ideas, let&rsquo;s browse the basics of this file:</p>
<h4>The <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> (before the markup)</h4>
<ul>
<li>Send a 503 <em>server</em> response to let the client know that they should try back later</li>
<li>Send a 503 <em>status</em> response to let the client know that they should try back later</li>
<li>Send a <code>Retry-After</code> header to tell the client <em>when</em> to try again (specified in seconds)</li>
<li>Send an email to the site admin letting them know that &ldquo;There is a problem with teh database!&rdquo;</li>
</ul>
<h4>The <acronym title="Hypertext Markup Language">HTML</acronym> markup</h4>
<ul>
<li><acronym title="Hypertext Markup Language">HTML</acronym> 5, baby!</li>
<li>Give it a title, might as well call it what it is</li>
<li>Add some <acronym title="Cascading Style Sheets">CSS</acronym> to make it all sweet</li>
<li>Throw down some custom markup and tell the user what&rsquo;s up</li>
</ul>
<p>From here, you can do just about anything. The <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> stuff is important to let robots and yourself know about the issue, and the markup is important for your human guests. For them, you may integrate your site&rsquo;s design as much (or as little) as desired. There really is no reason to get <em>too</em> fancy because ideally the page will be displayed for only a brief period. But I suppose if you&rsquo;re hosted on a crappy server you may want to pimp it out more fully&nbsp;;)</p>
<p>In any case, here are some more ideas and tips for customizing your own database error page:</p>
<ul>
<li>Make it more official with your logo and other branding embellishments</li>
<li>Link to some useful resources, perhaps some static stuff not dependent on the database (RSS Feed?)</li>
<li>Don&rsquo;t disclose the specific issue (i.e., database) &#8212; keep it general, like &ldquo;technical issues&rdquo; or whatever</li>
<li>If your database is down for awhile, save some bandwidth by keeping this file as small and optimized as possible</li>
</ul>
<h3>It would be so cool if..</h3>
<p>As it currently stands, this custom database error page is going to send you an email <em>every</em> single time <em>any</em> WordPress page is requested while the database is down. Especially for highly trafficked sites, this could result in thousands of emails flowing into your inbox. On smaller sites, this isn&rsquo;t really that big of an issue, but for larger sites it would be cool to get a script that would <strong>send only one email</strong> for each time the database went down. One way to do this would be to use <code>fwrite</code> to alter a static file with some specific text and then check for it before sending the next email, but this would require all sorts of fiddling that seems extraneous. I&rsquo;m sure there is a better way of doing it.</p>
<h3>Last words</h3>
<p>Hopefully this post gives you some ideas of what&rsquo;s possible with your own custom database error pages. It&rsquo;s nice that WordPress makes them so easy to set up and customize. Even better, because the <code>db-error.php</code> page is located in the <code>wp-content</code> directory, it is not modified or removed during the upgrade process. So just fix it and forget it. Definitely worthwhile to improve your site&rsquo;s overall visitor experience.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/11/custom-database-error-page/">Permalink</a> | <a href="http://digwp.com/2009/11/custom-database-error-page/#comments">17 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/11/custom-database-error-page/&title=Create a Custom Database Error Page in WordPress">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/database/" rel="tag">database</a>, <a href="http://digwp.com/tag/errors/" rel="tag">errors</a>, <a href="http://digwp.com/tag/security/" rel="tag">Security</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/11/custom-database-error-page/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Rude Things Plugins Can Do</title>
		<link>http://digwp.com/2009/10/rude-things-plugins-can-do/</link>
		<comments>http://digwp.com/2009/10/rude-things-plugins-can-do/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 14:00:11 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[maintenance]]></category>

		<guid isPermaLink="false">http://digwp.com/?p=627</guid>
		<description><![CDATA[I heart plugin authors. Their work is generally amazing, a huge benefit to the community, the reason why WordPress rules so much, and deserving of much worship. That being said, plugins can do some pretty rude things sometimes&#8230; Deactivate Themselves I had a plugin that I used that liked to deactivate it itself when you [...]]]></description>
			<content:encoded><![CDATA[<p>I heart plugin authors. Their work is generally amazing, a huge benefit to the community, the reason why WordPress rules so much, and deserving of much worship. That being said, plugins can do some pretty rude things sometimes&#8230;</p>
<p><span id="more-627"></span></p>
<h3>Deactivate Themselves</h3>
<p>I had a plugin that I used that liked to deactivate it itself when you upgraded it. I can&#8217;t say for absolutely sure why. Perhaps it wasn&#8217;t able to save settings after an upgrade and the default was off so when you upgraded it turned off. Perhaps there were new options so the author wanted people to go to the settings page to see all the new stuff. This particular plugin had all kinds of crap in the header of plugin about following him on Twitter and donating, so it was my suspicion that the turning off of the plugin was directed at making people look at all that stuff every time an upgrade was pushed out. He probably saw an uptick in donations when upgrades when out, so there was incentive to keep pushing out minor updates that shut off the plugin. </p>
<h3>Break Stuff</h3>
<p>Plugin authors are generally smart folks who realize that plugins meant to be used by a wide audience need to be as fool-proof as possible. If the plugin is complicated and requires use of outside files or interaction with other (theoretically default) WordPress files, testing should be done against a variety of installs and in conjunction with other popular plugins to make sure there are no conflicts. </p>
<p>If the plugin tinkers with existing functions, every one of them should be clearly explained so users can understand that use of those functions elsewhere may not behave as expected. Even things as simple as file paths can be problematic. As basic as that sounds, file paths should never be hard-coded.</p>
<h3>Have Bad Documentation</h3>
<p>To the best of the author&#8217;s ability, all plugins should include plain English explanations of why the plugin was created and what goal it hopes to accomplish. Beyond that, instructions for installation <strong>and uninstalling</strong> should be included. The WordPress plugin directory does a good job of providing &#8220;tabs&#8221; at the top of plugin pages for including this information. Also important is the FAQ section, which gives plugin authors another opportunity for plain English speak that is free from the sales-y introduction you have to do on the main page.</p>
<h3>Insert Crap</h3>
<p>Plugin authors know there are some hooks that almost everyone has, like wp_footer(). Hey why not add a force in a line of text down there linking back to the author site? Because that&#8217;s rude, that&#8217;s why.</p>
<h3>Make You Sign up for a Newsletter</h3>
<p>There was a plugin I once used fairly regularly that required &#8220;activation&#8221; that you got via email after signing up for the author&#8217;s email. That&#8217;s some strong-arm bullshit right there. And do you think this newsletter came only rarely and tastefully with important info? Obviously no, it came all the time, looked like shit, and was loaded with in-your-face proposals. Now there is a plugin that does the same thing without all that. Guess which one I use and support?</p>
<h3>Not Update</h3>
<p>WordPress changes, users needs change, so plugins need to update. If the plugin is so simple and sound it doesn&#8217;t really need constant point releases, its still important to go in to the documentation and indicate it is compatible with the most recent version of WordPress when that changes.</p>
<h3>Don&#8217;t Have Changelogs</h3>
<p>When a plugin <strong>does</strong> update, there should be at least some basic text explain what was changed and why. I always much appreciate plugin updates, but I&#8217;m not going to click that button until I can read from the author what was changed.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/10/rude-things-plugins-can-do/">Permalink</a> | <a href="http://digwp.com/2009/10/rude-things-plugins-can-do/#comments">21 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/10/rude-things-plugins-can-do/&title=Rude Things Plugins Can Do">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/errors/" rel="tag">errors</a>, <a href="http://digwp.com/tag/functions/" rel="tag">functions</a>, <a href="http://digwp.com/tag/maintenance/" rel="tag">maintenance</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/10/rude-things-plugins-can-do/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>3 Ways to Monitor PHP Errors</title>
		<link>http://digwp.com/2009/07/monitor-php-errors-wordpress/</link>
		<comments>http://digwp.com/2009/07/monitor-php-errors-wordpress/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 05:51:22 +0000</pubDate>
		<dc:creator>Jeff Starr</dc:creator>
				<category><![CDATA[HTAccess]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[maintenance]]></category>

		<guid isPermaLink="false">http://diggingintowordpress.com/?p=376</guid>
		<description><![CDATA[Close monitoring of your site&#8217;s PHP errors is crucial to operating a healthy, secure, and well-performing website. When left undetected, PHP errors can reduce performance, waste bandwidth, and leave your site vulnerable to malicious attack. PHP errors usually occur unpredictably and spontaneously, and may be triggered by even the slightest changes to your server configuration, [...]]]></description>
			<content:encoded><![CDATA[<p>Close monitoring of your site&rsquo;s <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors is crucial to operating a healthy, secure, and well-performing website. When left undetected, <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors can reduce performance, waste bandwidth, and leave your site vulnerable to malicious attack. <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors usually occur unpredictably and spontaneously, and may be triggered by even the slightest changes to your server configuration, database setup, or WordPress files. Even if your site appears to working properly on the surface, it may in fact be suffering from undetected <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors that should be fixed as soon as possible. </p>
<p>Monitoring <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors is something that all responsible WordPress administrators should be doing. In this <acronym title="Digging into WordPress">DiW</acronym> article, we&rsquo;ll show you three easy ways to monitor <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors for WordPress. The first method is exclusive to WordPress, and the second two methods work great for <em>any</em> website.</p>
<p><span id="more-376"></span></p>
<h3>Method 1: Error Logging via the WordPress configuration file</h3>
<p>Perhaps the <em>easiest</em> way to implement <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error-logging for your WordPress-powered site is to add a few simple lines of code to your <a href="http://digwp.com/2009/06/wordpress-configuration-tricks/" title="WordPress Configuration Tricks"><code>wp-config.php</code> file</a>. The WordPress <code>wp-config.php</code> file may be used to specify various <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> initiation settings to modify the functionality of your <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> installation. In this method, we will take advantage of this feature by implementing basic error monitoring for your site. Here&rsquo;s how to do it:</p>
<p><strong>Step 1: Create a log file</strong></p>
<p>Create an empty file called &ldquo;<code>php-errors.log</code>&rdquo;. This file will serve as your site&rsquo;s <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error log. Your server will need write access to this file, so make sure to set the appropriate permissions. This file may be placed in any directory, but placing it <em>above</em> the web-accessible root directory of your site is advisable for security reasons. Once this file is created, writable, and in place, take note of its absolute directory path and continue to the final step.</p>
<p><strong>Step 2: Add the magic code</strong></p>
<p>Next, open your site&rsquo;s <code>wp-config.php</code> file (located in the root WordPress directory) and place the following code immediately <em>above</em> the line that says, &ldquo;<code>That's all, stop editing! Happy blogging.</code>&rdquo;:</p>
<pre><code>// log php errors
@ini_set('log_errors','On'); // enable or disable php error logging (use 'On' or 'Off')
@ini_set('display_errors','Off'); // enable or disable public display of errors (use 'On' or 'Off')
@ini_set('error_log','/home/path/logs/php-errors.log'); // path to server-writable log file</code></pre>
<p>Once in place, edit the third line with the absolute directory path to the <code>php-errors.log</code> file created in the first step. Upload to your server and call it done. All <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors will now be logged to your <code>php-errors.log</code> file, thereby enabling you to monitor and resolve errors as quickly as possible.</p>
<p>The other two directives in this tasty little snippet enable you to log and display <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors at your will. The current configuration is ideal for production sites, but you may want to <em>enable</em> <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error display for development purposes. See the code comments for more information on changing these settings.</p>
<p><strong>Cool tips</strong></p>
<p>A couple of notes regarding this method.. First, if you place the following definition to your <code>wp-config.php</code> file, all WordPress debug errors will also be written to your <code>php-errors.log</code> file:</p>
<p><code>define('WP_DEBUG', true); // enable debugging mode</code></p>
<p>Also note that the code used for this example demonstrates a very basic implementation. You may add any number of additional <code>@ini_set()</code> directives to enhance and customize your error-logging system as needed.</p>
<h3>Method 2: Error Logging via the PHP initiation file</h3>
<p>If you have access to your site&rsquo;s <code>php.ini</code> file, or if you are able to implement &ldquo;per-directory&rdquo; initiation files, this method will enable you to monitor <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors for <em>any</em> website, not just those powered by WordPress. The process is very similar to the previous method, and requires the following two steps:</p>
<p><strong>Step 1: Create a log file</strong></p>
<p>Create an empty file called &ldquo;<code>php-errors.log</code>&rdquo;. This file will serve as your site&rsquo;s <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error log. Your server will need write access to this file, so make sure to set the appropriate permissions. This file may be placed in any directory, but placing it <em>above</em> the web-accessible root directory of your site is advisable for security reasons. Once this file is created, writable, and in place, take note of its absolute directory path and continue to the final step.</p>
<p><strong>Step 2: Add the magic code</strong></p>
<p>Next, open your site&rsquo;s <code>php.ini</code> file and add the following code:</p>
<pre><code>;;; log php errors
display_startup_errors = false
display_errors = false
html_errors = false
log_errors = true
track_errors = true
error_log = /home/path/logs/php-errors.log
error_reporting = E_ALL | E_STRICT
log_errors_max_len = 0</code></pre>
<p>As before, this code is configured for optimal error-handling for production servers. The only thing that you need to edit is the absolute directory path for your log file. During site development, you may want to change some of the variables to enable error display, startup errors, repeat errors, and so forth. For more information on these directives, and for a more in-depth guide to logging errors with <acronym title="PHP: Hypertext Preprocessor">PHP</acronym>, check out my article at Perishable Press, <a href="http://perishablepress.com/press/2008/01/30/advanced-php-error-handling-via-php/" title="Advanced PHP Error Handling via PHP">Advanced PHP Error Handling via PHP</a>.</p>
<h3>Method 3: Error Logging via the HTAccess file</h3>
<p>Last but not least, let&rsquo;s look at <a href="http://perishablepress.com/press/2007/12/17/how-to-enable-php-error-logging-via-htaccess/" title="How to Enable PHP Error Logging via htaccess">how to enable <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error-logging via HTAccess</a>. This method works great if <acronym title="Hypertext Access">HTAccess</acronym> files are enabled on your site, and will enable you to log <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors on <em>any</em> site, not just those powered by WordPress. The process is very similar to the previous method, and requires the following two steps:</p>
<p><strong>Step 1: Create a log file</strong></p>
<p>Create an empty file called &ldquo;<code>php-errors.log</code>&rdquo;. This file will serve as your site&rsquo;s <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error log. Your server will need write access to this file, so make sure to set the appropriate permissions. This file may be placed in any directory, but placing it <em>above</em> the web-accessible root directory of your site is advisable for security reasons. Once this file is created, writable, and in place, take note of its absolute directory path and continue to the final step.</p>
<p><strong>Step 2: Add the magic code</strong></p>
<p>Next, open your site&rsquo;s root <code>.htaccess</code> file and add the following code:</p>
<pre><code># log php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag  log_errors on
php_value error_log /home/path/logs/php-errors.log</code></pre>
<p>As before, this code is configured for optimal error-handling for production servers. The only thing that you need to edit is the absolute directory path for your log file. During site development, you may want to change some of the variables to enable error display, startup errors, repeat errors, and so forth. For more information on these directives, and for a more in-depth guide to logging <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors via <acronym title="Hypertext Access">HTAccess</acronym>, check out my article at Perishable Press, <a href="http://perishablepress.com/press/2008/01/14/advanced-php-error-handling-via-htaccess/" title="Advanced PHP Error Handling via htaccess">Advanced PHP Error Handling via htaccess</a>.</p>
<h3>Troubleshooting Tips</h3>
<p>To determine the absolute path of your log file, upload a <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> with the following code to the same directory and open it in a browser:</p>
<p><code>&lt;h3&gt;&lt;?php echo $_SERVER['DOCUMENT_ROOT']; ?&gt;&lt;/h3&gt;</code></p>
<p>Depending on your server configuration, you may need to use method #1 or #2 if you are running PHP5. Certain dual-PHP setups and other configurations may require any <code>php_value</code> directives to be placed in a <code>php.ini</code> file instead of <code>htaccess</code>.</p>
<p>An easy way to test that your error-logging system is working is to trigger a few basic <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> errors. To do so, create a <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> file and add something that will trigger an error, for example:</p>
<p><code>&lt;?php echo "error" ?&gt;</code></p>
<p>Lastly, if you are triggering errors but nothing is being written to your log file, triple-check that the file is writable by the server. Depending on your particular server configuration, you may need to increase the permissions level of the file. If you have to run with a setting of &ldquo;<code>777</code>&rdquo; (full permissions), definitely make sure that the log file is placed above the web-accessible root directory of your site.</p>
<h3>Wrap it up then</h3>
<p>With one of these three <acronym title="PHP: Hypertext Preprocessor">PHP</acronym> error-logging techniques, you have everything you need to implement easy, automatic error-logging for your website. Everything happens quietly behind the scenes, so remember to keep an eye on things by checking your log file periodically. Doing so will enable you to ensure a well-performing site and the best possible experience for your visitors.</p>
<hr />
<p><small>© 2009 <a href="http://digwp.com">Digging into WordPress</a> | <a href="http://digwp.com/2009/07/monitor-php-errors-wordpress/">Permalink</a> | <a href="http://digwp.com/2009/07/monitor-php-errors-wordpress/#comments">15 comments</a> | Add to <a href="http://del.icio.us/post?url=http://digwp.com/2009/07/monitor-php-errors-wordpress/&title=3 Ways to Monitor PHP Errors">del.icio.us</a> | Post tags: <a href="http://digwp.com/tag/errors/" rel="tag">errors</a>, <a href="http://digwp.com/tag/maintenance/" rel="tag">maintenance</a>, <a href="http://digwp.com/tag/php/" rel="tag">PHP</a><br/></small></p>]]></content:encoded>
			<wfw:commentRss>http://digwp.com/2009/07/monitor-php-errors-wordpress/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

