When PHP is processing a file upload and you receive the error message “Fatal error: Maximum execution time of 30 seconds exceeded” it is because the script has timed out. I was working on an application where this was occuring during a file upload. The entire file would be uploaded, then the error would be displayed
All over the web, you find people telling you to call set_time_limit() on the upload page. This overrides the max_execution_time setting which is found in php.ini. Calling this function on my upload page seems to have no effect on my server.
Changing max_execution_time in php.ini to 0 is supposed to be an unlimited timeout. However i was still receiving the error message. It would say “Fatal error: Maximum execution time of 0 seconds exceeded” which does not make any sense to me at all.
I discovered that, in addition to max_execution_time there is an additional setting max_input_time which controls how long a php file can spend processing the request data.
When i set max_input_time to a higher value, the problem goes away. So, it appears that the error message is reporting the wrong configuration variable.
PHP 4.3.4.4
Apache 2.0
Windows XP Pro SP1
#1 by Olivia on September 28th, 2007
Hi,
This is really helpful… and I know I’m going to sound very ‘green’ when I say this… but how can I edit the ‘max_execution_time’? I have no idea what ‘php.nin’ is exactly.
#2 by Jason on September 28th, 2007
Hi Olivia – php.ini is the global configuration file for PHP. Depending whether you are running on your own computer or a shared web host account, you may or not have access to change that file.
You can read more about it on the php site – http://www.php.net/ini
#3 by esra on October 15th, 2007
You might want to take a look at some existing PHP software to see how this is handled. I would recommend downloading a copy of the Joomla 1.1.x release along with the Docman or Repository components. Both allow the uoload and download of large files, especially Docman which is often used to handle the downloading and uploading of large PDF files.
#4 by Jason on October 15th, 2007
Hey Esra, Thanks for the Docman tip, I checked that out. Technically, you could still get this same execution error with those components because they still depend on the php ini settings. You can override ini settings in your php code using ini_set, which is what most upload/download components do. However you’ll run into a host once in a while that doesn’t allow it. Most decent hosts do, though.
#5 by Naveed Hussain on November 7th, 2007
Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/squirrelmail-1.4.9a/class/deliver/Deliver_SMTP.class.php on line 198
#6 by website designing Pakistan Peshawar on March 26th, 2008
Im also Having this problem,
i can set it in local php.ini file but from where i will set thise configuration when this is on hosting server because then i have no access to php.ini file
#7 by arkmads on May 20th, 2008
this was helpful…really helps me a lot..thanks to you
#8 by dieq41 on June 7th, 2008
I have change php.ini in C:/Windows like this.. “max_execution_time = 600 ; Maximum execution time of each script, in seconds”, but i still have the problem Fatal error: Maximum execution time of 30 seconds exceeded in C:\AppServ\www\diky\log_dndb\cari_dataesn_vcr.php on line 58.
#9 by dieq41 on June 7th, 2008
Guys, I have the answer..
I put the script like this..
//set time limit 180 seconds
in my script, it can work to run query more than 30 seconds.and the result..
“Time to query : 43.066 seconds.”..
Thx to all..
#10 by shanti on August 11th, 2008
hello friends…
i got the same error on my web page…
but is there any coding tips to load our page fastly,when we are using mysql,php,html.
#11 by Gulrez on September 26th, 2008
hello,
I have found only this solution for this error
“i set max_input_time to a higher value in my php.ini file” but if i m using only few php pages then how i can fix this problem by the coading.
Plz Reply
#12 by Plaska on December 26th, 2008
Thank you so much for posting this solution.
#13 by arafat on March 29th, 2009
simple follow this instruction: (why people always give hard instruction to others?)
1) Open your notepad. and paste this code:
max_execution_time = 120
max_input_time = 120
2) Save it as php.ini
3) Upload the file using FTP/Cpanel and Put in /administrator folder (joomla direcory)
4) DONE! Now you can install any files without having the message Fatal error: Maximum execution time of 30 seconds exceeded bla bla bla bla..
#14 by Jason on March 31st, 2009
thanks arafat. it’s probably good to mention that instructions are sometimes hard only because there are lots of different server configurations. not every server will recognize php.ini in the location you mentioned. also, i wouldn’t recommend overwriting your existing php.ini with a new file unless you understand what your are doing. you could accidentally wipe out important configuration settings.
#15 by umar on May 12th, 2009
hi,
i m also facing same problem
Fatal error: Maximum execution time of 30 seconds exceeded in c:\apache\htdocs\ims\process.php on line 42
and at line 42 i have this statement
while(!feof($fptr_id))
i read all your comments and other suggestions but i am not able to find “php.ini”,max_execution_time,max_input_time,etc
thanks ..
#16 by ram on June 4th, 2009
excellent the parameters retrned were really misleading, but this directive has solved the problem immediately