June 2017
Intermediate to advanced
536 pages
9h 49m
English
The maximum execution time is one of the most common errors developers come across. By default, the maximum execution time of the PHP script executing in the browser is 30 seconds, unless we execute the script within the CLI environment, where there is no such limitation.
We could easily test that through a simple example, given through the index.php and script.php files, as follows:
<?php// index.phprequire_once 'script.php';error_reporting(E_ALL);ini_set('display_errors', 'On');sleep(10);echo 'Test#1';
?php// script.phpsleep(25);echo 'Test#2';
Executed from within the browser, this will return the following error:
Test#2Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/index.php on line ...
Read now
Unlock full access