{"id":2227,"date":"2017-03-25T14:58:25","date_gmt":"2017-03-25T09:28:25","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=2227"},"modified":"2017-03-28T16:27:27","modified_gmt":"2017-03-28T10:57:27","slug":"fatal-error-maximum-execution-time-30-seconds-exceeded","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/fatal-error-maximum-execution-time-30-seconds-exceeded\/","title":{"rendered":"[Solved -10 Answers] PHP &#8211; Fatal error: Maximum execution time of 30 seconds exceeded"},"content":{"rendered":"<p><label class=\"label label-warning\">PROBLEM:<\/label><\/p>\n<ul>\n<li>When downloading a JSON file from an online source and it runs through the loop getting this error:<\/li>\n<li>Fatal error: Maximum execution time of 30 seconds exceeded in C:\\wamp\\www\\temp\\fetch.php on line 24<\/li>\n<\/ul>\n<p><label class=\"label label-info\">SOLUTION 1:<\/label><\/p>\n<ul>\n<li>Your loop might be endless. If it is not, you could extend the maximum execution time like this:<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">                    ini_set(&#039;max_execution_time&#039;, 300); \/\/300 seconds = 5 minutes<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<p><label class=\"label label-info\">SOLUTION 2:<\/label><\/p>\n<ul>\n<li>we solved it by changing the value for the param max_execution_time in php.ini, like this:<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">max_execution_time = 360      ; Maximum execution time of each script, in seconds (I CHANGED THIS VALUE)<br\/>max_input_time = 120          ; Maximum amount of time each script may spend parsing request data<br\/>;max_input_nesting_level = 64 ; Maximum input variable nesting level<br\/>memory_limit = 128M           ; Maximum amount of memory a script may consume (128MB by default)<\/code><\/pre> <\/div>\n<p><label class=\"label label-info\">SOLUTION 3:<\/label><\/p>\n<ul>\n<li>Just put this command in the begining of your script:<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">                              set_time_limit(0);<\/code><\/pre> <\/div>\n<p><label class=\"label label-info\">SOLUTION 4:<\/label><\/p>\n<ul>\n<li>Edit php.ini<\/li>\n<li>Find this line:<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">               max_execution_time<\/code><\/pre> <\/div>\n<ul>\n<li>Change its value to 300:<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">max_execution_time = 300<\/code><\/pre> <\/div>\n<ul>\n<li>300 means 5 minutes of execution time for the http request.<\/li>\n<\/ul>\n<p><label class=\"label label-info\">SOLUTION 5:<\/label><\/p>\n<ul>\n<li>In this problem while upgrading to WordPress 4.0. By default WordPress limits the maximum execution time to 30 seconds.<\/li>\n<li>Add the following code to your .htaccess file on your root directory of your WordPress Installation to over-ride the default.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">php_value max_execution_time 300  \/\/where 300 = 300 seconds = 5 minutes<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<p><label class=\"label label-info\">SOLUTION 6:<\/label><\/p>\n<ul>\n<li>You add an .htaccess file to the directory where your script is located and put this inside<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">&lt;IfModule mod_php5.c&gt;<br\/>php_value post_max_size 200M<br\/>php_value upload_max_filesize 200M<br\/>php_value memory_limit 300M<br\/>php_value max_execution_time 259200<br\/>php_value max_input_time 259200<br\/>php_value session.gc_maxlifetime 1200<br\/>&lt;\/IfModule&gt;<\/code><\/pre> <\/div>\n<ul>\n<li>Neither ini_set(&#8216;max_execution_time&#8217;, 86400); nor set_time_limit(86400) solved my problem , but the .htaccess method did.<\/li>\n<\/ul>\n<p><label class=\"label label-info\">SOLUTION 7:<\/label><\/p>\n<ul>\n<li>Neither ini_set(&#8216;max_execution_time&#8217;, 86400); nor set_time_limit(86400) solved my problem , but the .htaccess method did.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">ini_set(&#039;max_execution_time&#039;, 120); \/\/120 seconds = 2 minutes<\/code><\/pre> <\/div>\n<p><label class=\"label label-info\">SOLUTION 8:<\/label><\/p>\n<ul>\n<li>You can remove the restriction by setting it to zero by adding this line at the top of your script:<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">php code<\/span> <\/div> <pre class=\"language-php code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-php code-embed-code\">&lt;?php ini_set(&#039;max_execution_time&#039;, 0); ?&gt;<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<p><label class=\"label label-info\">SOLUTION 9:<\/label><\/p>\n<ul>\n<li>Follow the path \/etc\/php5(your php version)\/apache2\/php.ini.<\/li>\n<li>Open it and set the value of max_execution_time to a desired one.<\/li>\n<\/ul>\n<p><label class=\"label label-info\">SOLUTION 10:<\/label><\/p>\n<p>We can solve this problem in 3 different ways.<\/p>\n<ol>\n<li>Using php.ini file<\/li>\n<li>\u00a0Using .htaccess file<\/li>\n<li>\u00a0Using Wp-config.php file ( for WordPress )<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>PROBLEM: When downloading a JSON file from an online source and it runs through the loop getting this error: Fatal error: Maximum execution time of 30 seconds exceeded in C:\\wamp\\www\\temp\\fetch.php on line 24 SOLUTION 1: Your loop might be endless. If it is not, you could extend the maximum execution time like this: &nbsp; [ad [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[4858,4864,4866,4860,4865,4859,4863,4867,4862,4861],"class_list":["post-2227","post","type-post","status-publish","format-standard","hentry","category-php","tag-fatal-error-maximum-execution-time-of-0-seconds-exceeded","tag-fatal-error-maximum-execution-time-of-30-seconds-exceeded","tag-fatal-error-maximum-execution-time-of-30-seconds-exceeded-in","tag-fatal-error-maximum-execution-time-of-30-seconds-exceeded-on-line-64","tag-fatal-error-maximum-execution-time-of-30-seconds-exceeded-xampp","tag-fatal-error-maximum-execution-time-of-300-seconds-exceeded","tag-fatal-error-maximum-execution-time-of-500-seconds-exceeded","tag-fatal-error-maximum-execution-time-of-60-seconds-exceeded-for-wp-db-php","tag-fatal-error-maximum-execution-time-of-x-seconds-exceeded","tag-get-dates-fatal-error-maximum-execution-time-of-30-seconds-exceeded"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/2227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=2227"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/2227\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=2227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=2227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=2227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}