<?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>Fairul.org &#187; PHP</title>
	<atom:link href="http://www.fairul.org/category/programming/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fairul.org</link>
	<description>my life, photography, marathon, triathlon</description>
	<lastBuildDate>Thu, 29 Jul 2010 03:29:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Display PHP errors when display_errors is Disabled</title>
		<link>http://www.fairul.org/2009/10/display-php-errors-when-display_errors-is-disabled</link>
		<comments>http://www.fairul.org/2009/10/display-php-errors-when-display_errors-is-disabled#comments</comments>
		<pubDate>Mon, 12 Oct 2009 03:02:20 +0000</pubDate>
		<dc:creator>fairul</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[errors]]></category>

		<guid isPermaLink="false">http://www.fairul.org/?p=348</guid>
		<description><![CDATA[There are some servers where the webmasters or server admin wants to make the server more secure, they will disable the display_errors on the PHP settings. The php.ini will look like this: ; - display_errors = Off [Security] ; With this directive set to off, errors that occur during the execution of ; scripts will [...]]]></description>
			<content:encoded><![CDATA[<p>There are some servers where the webmasters or server admin wants to make the server more secure, they will disable the display_errors on the PHP settings.</p>
<p>The php.ini will look like this:</p>
<pre class="php">; - display_errors <span class="phpOperator">=</span> Off           <span class="phpOperator">[</span>Security<span class="phpOperator">]</span>
<span class="phpText">;</span>     With this directive set to off, errors that occur during the execution of
<span class="phpText">;</span>     scripts will no longer be displayed<span class="phpKeyword"> as </span>a part of the script output, and thus,
<span class="phpText">;</span>     will no longer be exposed to remote users<span class="phpOperator">.</span>  With some errors, the error message
<span class="phpText">;</span>     content may expose information about your script, web server, or database
<span class="phpText">;</span>     server that may be exploitable<span class="phpKeyword"> for </span>hacking<span class="phpOperator">.</span>  Production sites should have this
<span class="phpText">;</span>     directive set to off<span class="phpOperator">.</span>
Print out errors <span class="phpKeyword"><span class="phpOperator">(</span>as </span>a part of the output<span class="phpOperator">)</span>.  For production web sites,
<span class="phpText">;</span> you&#039;re strongly encouraged to turn this feature off, and<span class="phpKeyword"> use </span>error logging
<span class="phpText">;</span> instead <span class="phpOperator">(</span>see below<span class="phpOperator">)</span>.  Keeping display_errors enabled on a production web site
<span class="phpText">;</span> may reveal security information to end users, such<span class="phpKeyword"> as </span>file paths on your Web
<span class="phpText">;</span> server, your database schema or other information<span class="phpOperator">.</span>
display_errors <span class="phpOperator">=</span> On</pre>
<p>During apps development, u will need to display the errors in order for u to debug the code easily, so u can track what&#8217;s the error was.</p>
<p>Add below code on top of your PHP code:</p>
<pre class="php"><span class="phpFunction">ini_set</span><span class="phpOperator">(</span><span class="phpString">'display_errors'</span>, <span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpFunction">ini_set</span><span class="phpOperator">(</span><span class="phpString">'log_errors'</span>, <span class="phpNumber">1</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpFunction">ini_set</span><span class="phpOperator">(</span><span class="phpString">'error_log'</span>, <span class="phpFunction">dirname</span><span class="phpOperator">(</span><span class="phpConstant">__FILE__</span><span class="phpOperator">)</span> <span class="phpOperator">.</span> <span class="phpString">'/error_log<span class="phpOperator">.</span>txt'</span><span class="phpOperator">)</span><span class="phpText">;</span>  <span class="phpComment">// this is optional
</span><span class="phpFunction">error_reporting</span><span class="phpOperator">(</span><span class="phpConstant">E_ALL</span><span class="phpOperator">)</span><span class="phpText">;</span></pre>
<p>Happy coding with PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fairul.org/2009/10/display-php-errors-when-display_errors-is-disabled/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
