if i call a php file via jquery ajax, that contains a script to do some stuff that takes a while — for instance uploading a big video — and then I close the page: does the p
The script will run the time set by max_execution_time (default is 30s)
Warning This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini. Note: 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. This is not true on Windows where the measured time is real. quote from http://php.net/manual/en/function.set-time-limit.php
you can test this by running
and it will stop after 30s (despite you close your browser or not)
you can get you default exec time by echo ini_get('max_execution_time');
and can be set like set_time_limit(3);
The answer marked as accepted is only correct about the ignore_user_abort
but don't panic that your "fail" scripts will run forever if you don't set max exec time to 0 - unlimited;