If you run a long PHP script after you just installed XAMPP, you may encounter Fatal error: Maximum execution time of 120 seconds exceeded
. The error indicates that you have reached the default configuration of maximum execution time for a PHP script in XAMPP.
The error will also tell you the location of the file and code line that exceeded the maximum execution time. This is the example of the error message that I got when updating WordPress core on local server in XAMPP version 8.2.4-0:
Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\mysitename\wp-admin\includes\class-wp-filesystem-direct.php on line 82
How to increase PHP max execution time in XAMPP
The solution to fix Fatal error: Maximum execution time of 120 seconds exceeded
error is different than the solution to fix Fatal error: Maximum execution time of 300 seconds exceeded in XAMPP. The error messages seem similar with the difference only on the value of the maximum execution time (seconds), but the causes / triggers and configuration files are different.
These are the steps to reconfigure the maximum execution time for PHP script in XAMPP:
- Open file php.ini in folder C:\xampp\php.
- Search for
max_execution_time=120
. - Change the default value "120" to something bigger, e.g. 600, so it becomes
max_execution_time=600
.The value is time in seconds. 600 seconds is enough to finish updating WordPress core in localhost. You may need bigger value if you have bigger or longer PHP script.
- Save the change.
- Restart XAMPP.