Fatal error: Maximum execution time of 30 seconds exceeded
- March 30th, 2006
- Posted in PHP
- Write comment
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
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.
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
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.
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.
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
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
this was helpful…really helps me a lot..thanks to you
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.
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..
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.
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
Thank you so much for posting this solution.
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..
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.
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 ..
excellent the parameters retrned were really misleading, but this directive has solved the problem immediately
Great Thans alot
I changed both
max_execution_time = 600;
max_input_time = 600;
I have 11 MB file to download, I calculated the time for downloading it, and changed accordingly. But if the file size differs may be 100 MB, 200 MB, 750 MB then how much value need to place in
max_execution_time;
max_input_time
?
How I can fast up the downloading speed?
Do you have any efficient PHP downloading script? If so please send me.
Once again Thanks for you help
Hey Umar, the execution time is affected by the connection speed of your visitor, so there is no fixed number. You could probably calculate it based on a reasonable connection speed and then set your server limits with a conservative value.
i Have problem same like above but the diff is that i am trying to deleting 987900 from the database but in one time i can delete only 780 or 785. how can i delete the whole record
@Sukhwinder
The problem is not really with deleting, but just the script is taking too long to run. You either have to bump up the PHP limits or think of another way to accomplish that same thing. Maybe a queue or use ajax to do it in batches?