TCPDF Maximum execution time exceed 30 seconds - php

Can somebody please help me how to fix this error. I have a pdf page and I made a custom page size and made it landscape.
But when I run the page. It has an error saying "Maximum execution time exceeded 30 seconds in tcpdf.php line 18385
It only appears when I uploaded it in the server.
But when I use the program through remote it runs.
What seems to be the problem?

I had this issue as well on some content-heavy PDFs. PHP by default only allows a maximum execution time of 30 seconds.
You can increase this time in the php.ini file by changing the following line:
max_execution_time = 30
to
max_execution_time = 60
or adding this to the top of your script file.
set_time_limit(60);
60 seconds should be enough time for TCPDF to do what it needs to do but you may need to increase it further. Be careful with increasing it too much, however, as it can cause issues.
NOTE: If you're reaching the maximum execution time due to an infinite loop, this won't change anything.

you can use ini_set("you php config",0);

Related

Fatal error: Maximum execution time of 30 seconds exceeded. How to handle this error?

I am getting this error while running one script.
I know it's about execution time and i had went through all answers too but i want to display custom message when this error occurs so that site doesn't break.
How to handle that error as i have kept error display off on my live site so footer is not loaded due to this error which stops breaking my site?
http://whois.icann.org/en/lookup?name=google.com
When you visit this site its displaying custom error message
You can either increase the maximum execution time by using set_time_limit() or by setting max_execution_time in the php.ini.
Also by setting set_time_limit to 0 you can remove the limit for exceution time.
And if you are using linux you can try with the function register_shutdown_function.This function will be called when the execution time limit is reached.
You can try to add this line of code in the file first:
set_time_limit(0)
You can always modify your php.ini file. There is a setting for maximum execution time.
Another way is to use ini_set function.
Another way is to put the max execution time in your htaccess file.
EDIT:
The max execution time is not an error and therefore not catchable.
Please check out this: http://stackoverflow.com/questions/6861033/how-to-catch-the-fatal-error-maximum-execution-time-of-30-seconds-exceeded-in-p
Finally, there is always scope of fixing the scripts and putting lengthy processes into a queue.
you can exceed max execution time like this :
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
change below configuration in php.ini
max_execution_time = 600;
max_input_time = 120;
max_input_nesting_level = 64;
memory_limit = 128M;
ini_set('memory_limit', '-1');
ini_set('max_execution_time', '10000');
at the first line of your php code

Maximum execution time of 30 seconds exceeded for file upload

I need to upload big files with a PHP script. I set max_upload_size and so on. I tried to upload a big file that took 30 minutes. Than I get:
Maximum execution time of 30 seconds exceeded ... on line 1
My first line has a constant definition so it is impossibile that the script lose all exec time in that line.
Seems that the script excecution time get the elapsed time from the beginning of upload instead of the end... Am I right? I don't want to extend the normal execution time, I just want to let php count only its time and not the upload time. Is it possibile?
crete a php.ini file write
max_execution_time = 0
save and upload your main dir

PHP max execution time wrong

One of my PHP scripts is throwing the following error at me:
Fatal error: Maximum execution time of 30 seconds exceeded
The problem is that the script has only been executing for a few seconds.
I've timed everything between 2 and 10 seconds.
set_time_limit and ini_set('max_execution_time') have no effect (because of PHP safe mode).
Now I could just increase the value in my php.ini , but I would like to know why this error is thrown within a fraction of the actual maximum execution time.
The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running.
Or You can user set_time_limit(0) it will help only safemode.
This means that you might have an infinite loop somewhere or there is some code that has a timeout higher than 30 seconds.

PHP: "max execution time" immediately

I am currently running a large website based on our own framework. When uploading a picture we occasionaly get a Maximum execution time of 30 seconds exceeded within a fraction of a second. So I dont think the execution time is actually exceeded.
Does anyone have a clue what might cause this?
PHP version: 5.3.3
increase the execution time in php.ini file .in php.ini file search for "max_execution_time = 600".Default value is 600.
If you are using linux/ubuntu your php.ini file will be in lampp/etc/php.ini

time of 30 seconds exceeded error? file get contents

i have this error:
Fatal error: Maximum execution time of 30 seconds exceeded in C:\AppServ\www\facebook\classes\burccek.class.php on line 56
(im using file_get_contents)
(in this program i post file_get_contents data to facebook user wall(offline_access))
It means the file_get_contents operation takes more time that the max execution time of PHP. If you need a longer time, add this line at the top of your file: set_time_limit($seconds);
However 30 seconds seems a long time already so there might be some other issue with your application.
If duration of posting file to FB is longer than 30s (default maximum execution time of php script), use
set_time_limit ( 120 );
(or more in seconds) before executing file_get_contents
When posting data to other URLs, you should rely on CURL or even in extreme case may go to socket level. Curl has better control on connection time outs to handle network latency, much more set of options. In some hosting environments or servers a sys admin may restrict what all php.ini settings you can change, though you can change set_time_limit
You can change your set_time_limit in your php.ini file to alter the maximum execution time that php can use for a script.

Categories