The "fatal error or timeout occurred while processing this directive" error usually indicates that a process has taken too long to execute or a timeout value has been exceeded. Adjusting timeout settings can help resolve this issue. This guide is tailored for users with minimal technical knowledge and explains each step in detail.
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:
- PHP Timeout (e.g., script execution time).
- Web Server Timeout (e.g., Apache or NGINX settings).
- 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
- Create a new file named
phpinfo.phpin your website's root directory:<?php phpinfo(); ?> - Access the file in your browser:
http://yourwebsite.com/phpinfo.php - 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
- Open the php.ini file using a text editor:
sudo nano /etc/php/8.0/apache2/php.ini - 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 - 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.
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
- The Apache configuration file is typically located at:
- Ubuntu/Debian:
/etc/apache2/apache2.conf - CentOS/RHEL:
/etc/httpd/conf/httpd.conf
- Ubuntu/Debian:
- Open the file:
sudo nano /etc/apache2/apache2.conf
Modify Apache Timeout Directive
- Search for the Timeout directive:
Timeout 60 - 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
- Open the NGINX configuration file:
sudo nano /etc/nginx/nginx.conf - 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
- Log in to WHM (Web Host Manager).
- Navigate to Service Configuration > Apache Configuration > Global Configuration.
- 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:
- Open or create a
.htaccessfile in your website's root directory. - Add the following lines:
php_value max_execution_time 300 php_value max_input_time 300 - Save the file and test the changes.
Verify Changes
After modifying timeout settings, confirm they are applied:
- 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"; ?> - 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":
- Adjust PHP timeout settings in php.ini or .htaccess.
- Modify web server timeout settings in Apache or NGINX.
- Check and adjust cPanel-specific timeout settings via WHM or .htaccess.
- Verify changes using a debugging script.
- Monitor logs for additional errors.
By following these steps, you can eliminate timeout errors and ensure your application processes requests successfully.


