<?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>Poetry of Programming &#187; PHP</title>
	<atom:link href="http://www.poetryofprogramming.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.poetryofprogramming.com</link>
	<description>Because coding is art</description>
	<lastBuildDate>Wed, 15 Apr 2009 15:05:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Maximum execution time exceeded error workaround</title>
		<link>http://www.poetryofprogramming.com/php/php-maximum-execution-time-exceeded-error-workaround/</link>
		<comments>http://www.poetryofprogramming.com/php/php-maximum-execution-time-exceeded-error-workaround/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 13:01:03 +0000</pubDate>
		<dc:creator>Krzysztof Karolczak</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.poetryofprogramming.com/uncategorized/php-maximum-execution-time-exceeded-error-workaround/</guid>
		<description><![CDATA[The Maximum execution time of 30 seconds exceeded error can be annoying when executing &#8220;heavy&#8221; PHP scripts (involving lots of data processing) and it&#8217;s also a frequent follow-up of running Apache web servers on Windows machines   (for example when testing Symfony projects on your local PC). But no worries!   &#8211; there [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">The <em>Maximum execution time of 30 seconds exceeded </em>error can be annoying when executing &#8220;heavy&#8221; PHP scripts (involving lots of data processing) and it&#8217;s also a frequent follow-up of running Apache web servers on Windows machines <img src='http://www.poetryofprogramming.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  (for example when testing Symfony projects on your local PC). But no worries! <img src='http://www.poetryofprogramming.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8211; there are couple of easy ways to solve this problem. <span id="more-12"></span></p>
<p align="justify"><strong>Solution 1 &#8211; When we have access to PHP configurations files. </strong></p>
<p align="justify">If  we can edit the PHP config files the problem boils down to changing one variable in PHP.ini. Usually the right PHP.ini can be found in the main PHP dir (for example in my PHP WAMP intallation it&#8217;s located in <em>C:\wamp\bin\php\php5.2.5)</em>. And now we just need to open it and look for the line:</p>
<blockquote><p>max_execution_time = 30</p></blockquote>
<p align="justify">Changing the 30 seconds setting to something like 120 seconds should do the trick. And all we need to do now is to restart the web server. <img src='http://www.poetryofprogramming.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-5856107143683355";
google_ad_slot = "0824560404";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p><strong>Solution 2 &#8211; On a remote server.</strong></p>
<p align="justify">There is a nice PHP function called <span class="methodname"><em><strong><strong>set_time_limit ( </strong></strong>int $seconds<strong><strong> )</strong></strong></em>, every time it&#8217;s called it sets the timeout counter with the given value, which means that the script will now be able to run for <em>$seconds</em>. Execution of <em><strong>set_time_limit(0) </strong></em>removes the PHP timeout limit.</span></p>
<p align="justify">Unfortunately this will not work if PHP is running in <em>safe mode</em>. For further details consult the <a href="http://php.net/set_time_limit" target="_blank">PHP manual</a>.</p>
<p><strong>Other timeout possibilities <img src='http://www.poetryofprogramming.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </strong></p>
<p align="justify">It&#8217;s also worth mentioning that most of webservers have their own timeout counters &#8211; e.g. in Apache it&#8217;s set to 300 s by default. 6 minutes is usually plenty of time but it still can be changed if we desire so <img src='http://www.poetryofprogramming.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The timeout setting can be found in <em>httpd-default.conf </em>file which is located with the rest of Apache conf files (e.g. my path is <em>C:\wamp\bin\apache\apache2.2.6\conf\extra</em>).</p>
<p style="text-align: center;"><script type="text/javascript"><!--
google_ad_client = "pub-5856107143683355";
google_ad_slot = "0824560404";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poetryofprogramming.com/php/php-maximum-execution-time-exceeded-error-workaround/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
