Linux Webhosting Solutions: modfcgid: MaxRequestLen
Introduction
The mod_fcgid: MaxRequestLen error occurs when the size of an HTTP request exceeds the maximum request length configured for the Apache mod_fcgid module. This issue is commonly encountered when uploading large files in applications such as WordPress and Joomla. Increasing the MaxRequestLen value in the FCGI PHP configuration file resolves the problem and allows larger file uploads.
Prerequisites
- Root or sudo access to the server
- Apache with the mod_fcgid module installed
- Access to the domain’s FCGI PHP configuration file
- Basic knowledge of editing configuration files and restarting Apache
Implementation
Step 1
Identify the issue by checking the Apache error log.
Example:
tail -f /usr/local/apache/logs/error_log | grep domainname.com
You may see an error similar to:
[warn] mod_fcgid: HTTP request length 131274 (so far) exceeds MaxRequestLen (131072)
Step 2
Locate the FCGI PHP configuration file for the affected domain.
The configuration file is usually located at:
/usr/local/apache/etc/userdata/std/2///phpini.conf
Step 3
Open the configuration file using a text editor.
Example:
vi /usr/local/apache/etc/userdata/std/2/domain/domainname.com/phpini.conf
Step 4
Modify the configuration by adding the following line inside the <IfModule mod_fcgid.c> block:
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
MaxRequestLen 15728640
Step 5
Save the configuration file.
Step 6
Restart the Apache service to apply the changes.
service httpd restart
Conclusion
Increasing the MaxRequestLen value in the mod_fcgid configuration allows Apache to accept larger HTTP requests, resolving upload failures in applications such as WordPress and Joomla. After updating the configuration and restarting Apache, verify that large file uploads complete successfully without triggering the MaxRequestLen error.
