Maximum execution time of 300 seconds in Xampp on Windows

Maximum execution time of 300 seconds in Xampp on Windows

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Maximum execution time of 300 seconds in XAMPP on Windows

You've likely encountered this error when a script runs longer than expected: Fatal error: Allowed memory limit of ... often goes hand-in-hand, but here we are focusing specifically on the Maximum execution timeout. The immediate frustration comes from the fact that you've already touched the usual suspects. You modified max_execution_time in php.ini, adjusted the Timeout directive in httpd.conf (or httpd-xampp.conf) under Apache, and even tried injecting set_time_limit() or ini_set('max_execution_time', 0) directly into your PHP code. Despite these efforts, the error persists.

This happens because XAMPP on Windows operates with a specific architectural quirk regarding how it handles persistent connections versus script execution limits. The root cause isn't just one setting; it's a collision between Apache's request timeout and PHP's internal execution timer. When you change max_execution_time in php.ini, you are telling the PHP interpreter how long it can run. However, Apache sits in front of PHP and enforces its own hard limit on how long it will wait for a response before cutting off the connection.

In XAMPP's default configuration, this Apache timeout is often hardcoded or set to a lower value (commonly 300 seconds) specifically to prevent hanging requests from consuming server resources indefinitely. Even if your PHP script is allowed to run for an hour, Apache will terminate the request after 5 minutes if it hasn't sent any output or headers yet. This creates a situation where set_time_limit() works perfectly fine in CLI mode but fails completely in a web context because Apache kills the process before PHP even gets a chance to check its internal timer.

To resolve this, you need to ensure that both layers are aligned. First, verify your php.ini file is actually being loaded by the specific Apache instance XAMPP uses. Simply renaming php.ini in the root directory isn't enough; you must locate the file referenced by the php_value directive or check if XAMPP is using a bundled php.ini-development or php-production. Look for the max_execution_time directive and set it to 300 or higher, or use -1 to indicate no limit.

Next, address the Apache layer. Open your Apache configuration file, typically found at xampp/apache/conf/httpd.conf or sometimes specifically under conf/extra/httpd-xampp.conf. Search for the Timeout directive. You will likely see a line resembling Timeout 300. Change this value to match or exceed your PHP max_execution_time, or set it to -1 if you want to disable the timeout entirely.

Timeout -1

After making these changes, restart Apache via the XAMPP Control Panel. It is crucial to note that editing these files while XAMPP is running can lead to syntax errors or ignored configurations; a full restart ensures the new directives take effect immediately.

There is a trade-off here. Disabling timeouts entirely (Timeout -1) in a production environment is generally discouraged because a runaway script could freeze your entire web server, making the site unavailable until you manually kill the process. However, in a local development environment like XAMPP, where you have direct control over the machine and resources are less critical than convenience during debugging, removing these limits is often the pragmatic solution.

If you are developing a Laravel application or similar framework that relies on long-running tasks, remember that set_time_limit() inside your controller or route will only help if Apache hasn't already timed out the request. The order of operations matters: Apache must be configured to wait longer than the script intends to run. Without this alignment, no amount of PHP code can override the network-level cutoff imposed by the web server.

Our network