PHP Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\vendor\symfony\process\Pipes\WindowsPipes.php on line 140
Asked Answered
B

4

5

When I try to upload video that is larger than 15MB using Ajax and Laravel I get this error:

PHP Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\vendor\symfony\process\Pipes\WindowsPipes.php on line 140

I use Ffmpeg and Symfony/process

the error in symfony windowsPipes.php in Laravel.

What is problem?

Birthroot answered 31/7, 2018 at 9:42 Comment(3)
Possible duplicate of Fatal error: Maximum execution time of 30 seconds exceededTomokotomorrow
60 seconds sounds like it should be enough to upload a 15mb file. What other things are you doing with it?Agitprop
i use ffmpeg to encoding video to add watermarkBirthroot
O
11

You can set max_execution_time in your php.ini:

max_execution_time=300

Or, in your PHP code:

ini_set('max_execution_time', 300); // 5 minutes

Setting it to zero removes the restriction, however apache might also time out in that scenario.

Check the manual http://php.net/manual/en/info.configuration.php#ini.max-execution-time

This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30. When running PHP from the command line the default setting is 0.

The maximum execution time is not affected by system calls, stream operations etc. Please see the set_time_limit() function for more details.

You can not change this setting with ini_set() when running in safe mode. The only workaround is to turn off safe mode or by changing the time limit in the php.ini.

Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a Timeout directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.

Orography answered 31/7, 2018 at 9:45 Comment(4)
when i added it in my php.ini, its show me this error PHP: syntax error, unexpected '(' in C:\xampp\php\php.ini on line 221Birthroot
@GhyathDarwish because this is PHP code, not config. If you want to write it in php.ini, you have to write just max_execution_time=300Burgener
i also restarted server, but it is stillBirthroot
set_time_limit(300) in your PHP code might work as wellAgitprop
C
1

Problem is that uploading is taking more then 30 sec, you could extend the maximum execution time like this, go to php.ini in your xampp and set this

ini_set('max_execution_time', 300); //300 seconds = 5 minutes
Colan answered 31/7, 2018 at 9:44 Comment(0)
V
0

Setting max_execution_time in php.ini file may not work in all scenarios, anyway set it for some 300 seconds. But for all scenarios, writing ini_set('max_execution_time', 300); in the file you want to execute will do the work for you.

Vasilikivasilis answered 26/2, 2021 at 5:36 Comment(0)
B
0

There are two options:

1.

set_time_limit set the maximum execution time for the current script without altering the php.ini file. The change is temporary and applies only to the current script.

set_time_limit(300); // 5 minutes

init_set modifies the max_execution_time directive in the php.ini file, affecting all PHP pages using this configuration. As described in the documentation "The configuration option will keep this new value during the script's execution, and will be restored at the script's ending".

ini_set('max_execution_time', 300); // 5 minutes

Both functions limit the execution time of a PHP script, but set_time_limit affects only the current script, while ini_set influences all PHP pages using the configuration directive.

Behr answered 21/4, 2023 at 9:10 Comment(3)
False; calling ini_set() does not persist the changes, and only works in the context of the current request, just like set_time_limit(). I believe the main difference between the two is that calling set_time_limit() actually restarts the timer, while ini_set() supposedly doesn't.Trilby
tnks, its work for meBoyse
@Trilby it's explained in ini_set documentation: "The configuration option will keep this new value during the script's execution, and will be restored at the script's ending".Behr

© 2022 - 2024 — McMap. All rights reserved.