Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Fixing "Fatal Error or Timeout" by Adjusting Timeout Settings

5 min read
16.04.2026

Understanding Timeout Settings

Timeout settings determine how long a process (like PHP script execution or a server request) is allowed to run before it is terminated. There are timeout settings at multiple levels:

Timeout Settings Adjustment
Layered timeout stack — align lowest to be at least PHP limit + margin.

For related timeout topics, see Fixing "Fatal Error or Timeout Occurred" in cPanel, Increasing PHP Limits, and SMTP Error 110 — Connection Timed Out.

  1. PHP Timeout (e.g., script execution time).
  2. Web Server Timeout (e.g., Apache or NGINX settings).
  3. cPanel Timeout Settings (specific to hosting control panels like cPanel).

Identifying Your Setup

Before proceeding, identify which web server you're using. You can check by looking at your server's control panel or contacting your hosting provider. Common setups are:

  • Apache: Most common on shared hosting and cPanel servers
  • NGINX: Often used for high-performance websites
  • cPanel: Popular control panel with its own timeout settings

Adjust PHP Timeout Settings

The most common cause of timeouts is PHP script execution taking too long. To fix this, you need to increase PHP timeout values.

Locate the PHP Configuration File

  1. Create a new file named phpinfo.php in your website's root directory:
    <?php
    phpinfo();
    ?>
  2. Access the file in your browser:
    http://yourwebsite.com/phpinfo.php
  3. Look for the Loaded Configuration File section. It will show the path to the active php.ini file (e.g., /etc/php/8.0/apache2/php.ini).

Edit the php.ini File

  1. Open the php.ini file using a text editor:
    sudo nano /etc/php/8.0/apache2/php.ini
  2. Search for the following directives and increase their values:
    max_execution_time = 300  ; Maximum time (in seconds) a script is allowed to run
    max_input_time = 300      ; Maximum time to parse POST and GET data
    memory_limit = 512M       ; Maximum memory a script can use
  3. Save the changes and exit the editor.

Restart Your Web Server

Changes to php.ini require a server restart:

  • For Apache:
    sudo systemctl restart apache2
  • For NGINX:
    sudo systemctl restart php8.0-fpm

Test the Changes

  • Retry the operation that caused the timeout to see if it resolves the issue.
  • If you still encounter the timeout, proceed to adjust web server settings.
cPanel Hosting
Full control over your website
  • Convenient
  • Simple
  • Fast
  • Free 7-day trial
cPanel Hosting

Adjust Apache Timeout Settings

If PHP limits are not the cause, the Apache web server may be terminating the request prematurely.

Locate Apache Configuration File

  1. The Apache configuration file is typically located at:
    • Ubuntu/Debian: /etc/apache2/apache2.conf
    • CentOS/RHEL: /etc/httpd/conf/httpd.conf
  2. Open the file:
    sudo nano /etc/apache2/apache2.conf

Modify Apache Timeout Directive

  1. Search for the Timeout directive:
    Timeout 60
  2. Increase the value to allow longer processing time:
    Timeout 300

Restart Apache

Restart Apache to apply the changes:

sudo systemctl restart apache2

Additional Apache Timeout Settings

For specific operations, you may need to adjust these directives:

  • KeepAliveTimeout: Time to wait for subsequent requests:
    KeepAliveTimeout 300
  • Proxy Timeout (if using reverse proxy):
    ProxyTimeout 300

Adjust NGINX Timeout Settings

If your server uses NGINX instead of Apache, you need to adjust its timeout settings.

Locate NGINX Configuration

  1. Open the NGINX configuration file:
    sudo nano /etc/nginx/nginx.conf
  2. Alternatively, locate the specific virtual host configuration for your site (e.g., /etc/nginx/sites-available/your-site).

Update NGINX Timeout Directives

Add or update the following timeout directives inside the http or server block:

http {
    client_body_timeout 300;
    client_header_timeout 300;
    send_timeout 300;
    fastcgi_read_timeout 300;
}

Reload NGINX

Restart NGINX to apply the changes:

sudo systemctl reload nginx

Adjust Timeout Settings in cPanel

If you're using cPanel, there are additional timeout settings that can cause this error.

Increase Timeout via WHM

  1. Log in to WHM (Web Host Manager).
  2. Navigate to Service Configuration > Apache Configuration > Global Configuration.
  3. Increase the Timeout value to 300 seconds or more.

Modify .htaccess for User-Specific Timeout

If you don't have access to server-level configurations, use .htaccess to increase timeout values:

  1. Open or create a .htaccess file in your website's root directory.
  2. Add the following lines:
    php_value max_execution_time 300
    php_value max_input_time 300
  3. Save the file and test the changes.

Verify Changes

After modifying timeout settings, confirm they are applied:

  1. Create a PHP file named debug.php:
    <?php
    echo "Max Execution Time: " . ini_get('max_execution_time') . "\n";
    echo "Max Input Time: " . ini_get('max_input_time') . "\n";
    ?>
  2. Access it in your browser:
    http://yourwebsite.com/debug.php

Monitor Logs for Further Issues

If the problem persists, check server logs for more clues:

  • Apache Logs:
    tail -f /var/log/apache2/error.log
  • NGINX Logs:
    tail -f /var/log/nginx/error.log
  • PHP Error Logs:
    tail -f /var/log/php_errors.log

Summary

To fix "A Fatal Error or Timeout Occurred While Processing This Directive":

  1. Adjust PHP timeout settings in php.ini or .htaccess.
  2. Modify web server timeout settings in Apache or NGINX.
  3. Check and adjust cPanel-specific timeout settings via WHM or .htaccess.
  4. Verify changes using a debugging script.
  5. Monitor logs for additional errors.

By following these steps, you can eliminate timeout errors and ensure your application processes requests successfully.

Frequently asked questions
Client (browser ~5 min) → CDN (Cloudflare 100s default) → reverse proxy (nginx 60s default) → web server (Apache Timeout 60s default) → app (PHP max_execution_time 30s default). Whichever is lowest cuts off. For a 5-minute job, all need to be >300s including the CDN.
Free/Pro plans: 100s hard limit. Business/Enterprise: 600s. For longer operations on Free/Pro: return early (start the job, return job ID, poll for completion). Or proxy-bypass Cloudflare for that specific endpoint via DNS-only record. Architectural fix preferred over plan upgrade.
`Timeout` is the global Apache timeout for client-server communication. `ProxyTimeout` overrides for mod_proxy / mod_proxy_fcgi connections (used when Apache fronts PHP-FPM). Set both: `Timeout 600` + `ProxyTimeout 600`. mod_proxy without ProxyTimeout falls back to Timeout, so explicit setting is best.
60 seconds. Set in `http`, `server`, or `location` block. For long PHP operations: `fastcgi_read_timeout 600;` in the PHP-handling location. Also `proxy_read_timeout` if you're proxying. Restart nginx, verify with sleep test (`` should complete).
Related articles
Fixing "A Fatal Error or Timeout Occurred" by Increasing PHP Limits
Fixing "A Fatal Error or Timeout Occurred While Processing This Directive"
Fixing "Internal Server Error" (500) in Apache/Nginx