{"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>\u00a0<\/p>\n[pastacode lang=\u201dphp\u201d manual=\u201d%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ini_set(\u2018max_execution_time\u2019%2C%20300)%3B%20%2F%2F300%20seconds%20%3D%205%20minutes%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\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[pastacode lang=\u201dphp\u201d manual=\u201dmax_execution_time%20%3D%20360%20%20%20%20%20%20%3B%20Maximum%20execution%20time%20of%20each%20script%2C%20in%20seconds%20(I%20CHANGED%20THIS%20VALUE)%0Amax_input_time%20%3D%20120%20%20%20%20%20%20%20%20%20%20%3B%20Maximum%20amount%20of%20time%20each%20script%20may%20spend%20parsing%20request%20data%0A%3Bmax_input_nesting_level%20%3D%2064%20%3B%20Maximum%20input%20variable%20nesting%20level%0Amemory_limit%20%3D%20128M%20%20%20%20%20%20%20%20%20%20%20%3B%20Maximum%20amount%20of%20memory%20a%20script%20may%20consume%20(128MB%20by%20default)%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\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>\u00a0<\/p>\n[pastacode lang=\u201dphp\u201d manual=\u201d%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20set_time_limit(0)%3B%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\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[pastacode lang=\u201dphp\u201d manual=\u201d%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20max_execution_time%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>Change its value to 300:<\/li>\n<\/ul>\n[pastacode lang=\u201dphp\u201d manual=\u201dmax_execution_time%20%3D%20300\u2033 message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\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[pastacode lang=\u201dphp\u201d manual=\u201dphp_value%20max_execution_time%20300%20%20%2F%2Fwhere%20300%20%3D%20300%20seconds%20%3D%205%20minutes%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\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[pastacode lang=\u201dphp\u201d manual=\u201d%3CIfModule%20mod_php5.c%3E%0Aphp_value%20post_max_size%20200M%0Aphp_value%20upload_max_filesize%20200M%0Aphp_value%20memory_limit%20300M%0Aphp_value%20max_execution_time%20259200%0Aphp_value%20max_input_time%20259200%0Aphp_value%20session.gc_maxlifetime%201200%0A%3C%2FIfModule%3E%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n<ul>\n<li>Neither ini_set(\u2018max_execution_time\u2019, 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(\u2018max_execution_time\u2019, 86400); nor set_time_limit(86400) solved my problem , but the .htaccess method did.<\/li>\n<\/ul>\n[pastacode lang=\u201dphp\u201d manual=\u201dini_set(\u2018max_execution_time\u2019%2C%20120)%3B%20%2F%2F120%20seconds%20%3D%202%20minutes\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\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[pastacode lang=\u201dphp\u201d manual=\u201d%3C%3Fphp%20ini_set(\u2018max_execution_time\u2019%2C%200)%3B%20%3F%3E%0A\u201d message=\u201dphp code\u201d highlight=\u201d\u201d provider=\u201dmanual\u201d\/]\n[ad type=\u201dbanner\u201d]\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: \u00a0 [pastacode [&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}]}}