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
Related
I'm trying to copy a 10GB file to another directory in my local disk using this code
Storage::copy( 'file/test.txt', 'file2/dest.txt' );
But when I check it on the destination path it only copied 1.7GB out of 10GB.
It didn't show any timeout errors at all.
Is there any work around on this?
as long as invoking php script will be happen with a request. a malicious code can turns system into an infinite loop, or an attacker (Danial of Service) can make a script run for a long time.
so to preventing this. PHP came up with some default setting which make it to not run for a long time period and exit the execution if some amount of time out passed and it didn't returned a response.
usually this times are sufficient. and its an unusual case you have to copy 10 GB file within a script run
i suppose you have a regular HDD whit speed of about 60 MB/s for a
execution time of 30 seconds, it will copy about 1800 MB. and it make
sense with your evidence.
Temporary fix
10000 MB / 60 MBps = 168 second. i come up with 180 second via a margin
in your php.ini , in Resource Limit Section, there are parameters for time out.
uncomment them and make them 180 seconds:
max_execution_time = 180
max_input_time = 180
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);
I have a script in php which takes data from a database and writes it in a file. The first time I ran the script I got this:
Fatal error: Maximum execution time of 240 seconds exceeded.
So I changed this time in my php.ini to 300 and ran the script again. This time, it works. However, on running the script a second time I get this error:
Fatal error: Maximum execution time of 300 seconds exceeded.
After changing the time to 300 now, it works again but only the first time.
Any idea as to why I have to keep on increasing this max_execution_time?
At the beginning of your script you can add.
ini_set('MAX_EXECUTION_TIME', -1);
This line of code will drop the max execution time restriction of a code, allowing a php code to run forever.
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
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.