<?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>Ardamis &#187; 500 error</title>
	<atom:link href="http://www.ardamis.com/tag/500-error/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ardamis.com</link>
	<description>Ardamis is a blog about web development and technology in general.</description>
	<lastBuildDate>Sat, 04 Feb 2012 15:26:27 +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>How to fix the &#8220;PHP Fatal error:  Call to undefined function  get_header()&#8221; error in WordPress</title>
		<link>http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/</link>
		<comments>http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 17:07:13 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[500 error]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1430</guid>
		<description><![CDATA[Fix the "PHP Fatal error: Call to undefined function get_header()" error in WordPress.]]></description>
			<content:encoded><![CDATA[<p>While making changes to my WordPress theme, I noticed that the error_log file in my theme folder contained dozens of PHP Fatal error lines:</p>
<pre class="brush: plain; title: ; notranslate">
...
[01-Jun-2011 14:25:15] PHP Fatal error:  Call to undefined function  get_header() in /home/accountname/public_html/ardamis.com/wp-content/themes/ars/index.php on line 7
[01-Jun-2011 20:58:23] PHP Fatal error:  Call to undefined function  get_header() in /home/accountname/public_html/ardamis.com/wp-content/themes/ars/index.php on line 7
...
</pre>
<p>The first seven lines of my theme&#8217;s index.php file:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php ini_set('display_errors', 0); ?&gt;
&lt;?php
/**
 * @package WordPress
 * @subpackage Ars_Theme
*/
get_header(); ?&gt;
</pre>
<p>I realized that the error was being generated each time that my theme&#8217;s index.php file was called directly, and that the error was caused by the theme&#8217;s inability to locate the WordPress <strong>get_header</strong> function (which is completely normal).  Thankfully, the descriptive error wasn&#8217;t being output to the browser, but was only being logged to the error_log file, due to the inclusion of the <strong>ini_set(&#8216;display_errors&#8217;, 0);</strong> line.  I had learned this the hard way a few months ago when I found that calling the theme&#8217;s index.php file directly would generate an error message, output to the browser, that would reveal my hosting account username as part of the absolute path to the file throwing the error.</p>
<p>I decided the best way to handle this would be to check to see if the file could find the <strong>get_header</strong> function, and if it could not, simply redirect the visitor to the site&#8217;s home page.  The code I used to do this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php ini_set('display_errors', 0); ?&gt;
&lt;?php
/**
* @package WordPress
* @subpackage Ars_Theme
*/
if (function_exists('get_header')) {
	get_header();
}else{
    /* Redirect browser */
    header(&quot;Location: http://&quot; . $_SERVER['HTTP_HOST'] . &quot;&quot;);
    /* Make sure that code below does not get executed when we redirect. */
    exit;
}; ?&gt;
</pre>
<p>So there you have it.  No more fatal errors due to <strong>get_header</strong> when loading the WordPress theme&#8217;s index.php file directly.  And if something else in the file should throw an error, <strong>ini_set(&#8216;display_errors&#8217;, 0);</strong> means it still won&#8217;t be sent to the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/06/02/fix-for-php-fatal-error-get_header-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A chart illustrating the reduction in comment spam at ardamis.com</title>
		<link>http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/</link>
		<comments>http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 19:12:09 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[500 error]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[comment spam]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/?p=1228</guid>
		<description><![CDATA[A screenshot of the Akismet stats graph showing the number of spam comments at ardamis.com identified by Akismet before and after my anti-spam system was implemented.]]></description>
			<content:encoded><![CDATA[<p>In August, 2010, I described <a href="http://www.ardamis.com/2010/08/09/reducing-wordpress-spam-comments/">a simple method for dramatically reducing the number of spam comments</a> that are submitted to a WordPress blog.  The spam comments are rejected before they are checked by Akismet, so they never make it into the database at all.</p>
<p>Now, a few months later, I&#8217;m posting a screenshot of the Akismet stats graph from the WordPress dashboard showing the number of spam comments identified by Akismet before and after the system was implemented.</p>
<div id="attachment_1229" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.ardamis.com/wp-content/uploads/2011/01/akismet-500.jpg"><img src="http://www.ardamis.com/wp-content/uploads/2011/01/akismet-500.jpg" alt="" title="akismet-500" width="500" height="340" class="size-full wp-image-1229" /></a><p class="wp-caption-text">Akismet stats for August - December, 2010</p></div>
<p>The spike in spam comments detected around November 3rd occurred after an update to WordPress overwrote my altered wp-comments.php file.  I replaced the file and the spam dropped back down to single digits per day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2011/01/18/a-chart-illustrating-the-reduction-in-comment-spam-at-ardamis-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>500 error with GoDaddy&#8217;s form mail</title>
		<link>http://www.ardamis.com/2007/12/15/500-error-with-godaddys-form-mail/</link>
		<comments>http://www.ardamis.com/2007/12/15/500-error-with-godaddys-form-mail/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 07:31:10 +0000</pubDate>
		<dc:creator>ardamis</dc:creator>
				<category><![CDATA[Web Site Dev]]></category>
		<category><![CDATA[500 error]]></category>
		<category><![CDATA[godaddy]]></category>

		<guid isPermaLink="false">http://www.ardamis.com/2007/12/15/500-error-with-godaddys-form-mail/</guid>
		<description><![CDATA[I was getting a 500 error when trying to submit a form mail from my web site via GoDaddy&#8217;s gdform.cgi. I turned on error logging and this is what showed up: SoftException in Application.cpp:624: Could not execute script "/home/content/a/r/d/ardamis/html/cgi/gdform.cgi" Caused by SystemException in API_Linux.cpp:430: execve() for program "/home/content/a/r/d/ardamis/html/cgi/gdform.cgi" failed: Permission denied [Sun Dec 2 01:34:05 [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting a 500 error when trying to submit a form mail from my web site via GoDaddy&#8217;s gdform.cgi.  I turned on error logging and this is what showed up:</p>
<pre><code>SoftException in Application.cpp:624: Could not execute script "/home/content/a/r/d/ardamis/html/cgi/gdform.cgi"
Caused by SystemException in API_Linux.cpp:430: execve() for program "/home/content/a/r/d/ardamis/html/cgi/gdform.cgi" failed: Permission denied
[Sun Dec  2 01:34:05 2007] [error] [client 76.224.44.87] Premature end of script headers: /var/chroot/home/content/a/r/d/ardamis/html/cgi/gdform.cgi</code></pre>
<p>After some Googling, I changed the permissions on gdform.cgi to Executable by Owner and that fixed the problem.  I don&#8217;t know if this exposes me to any security risks, but at the very least I should probably move or rename my scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardamis.com/2007/12/15/500-error-with-godaddys-form-mail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

