OK here's a fun one, after much reading about the reason I couldn't get files to upload via http(s) for a client (my good lady's audio typing website) there are tips aplenty on StackOverflow and others telling you to reset the FcgidMaxRequestLen parameter in the mod_fcgi module block in both vhost.conf and the fcgid.conf, which I duly did.
(side point) I may as well mention at this point, the server we purchase from 1&1 Internet is a Plesk Control Panel which is fine until you want to do major customisation. In the past if you made changes to the core php.ini or vhost.conf file you would find it was overwritten each time a Plesk update was implemented or for whatever reason re-compiled. Latter versions of Plesk have made it easier to manage this by placing safe copies of localised conf files in a new system sub-folder, but still a pain when you don't know where to look!
Older versions of Plesk = /var/www/vhosts/{your-domain}/etc
Plesk 11+ = var/www/vhosts/system{your-domain}
But this is an aside and largely only confined to php.ini changes.
Our local php.ini file which seemed to pickup the changes which were identified within it when running the phpinfo() command showed the custom settings
set into the php environment
So, with these settings in place we proceeded to attempt to upload sound files. No luck, and didn't even get errors so were completely in the dark.
We got an nginx error was identified as a PHP framework issue and that was fixed during which we set the log files to be in the root of the vhost file which, on Plesk 11 + looks like this
So, each upload then started throwing a common line based on a configuration entry which looked like this:
[warn] [client ip address] mod_fcgid: HTTP request length 134220467 (so far) exceeds MaxRequestLen (134217728), referer: name of script running the upload
OK so did more googling and found lots of results for newer builds of apache running with a low limit of 128K per upload, so duly followed these and updated the:
/etc/httpd/conf.d/fcgid.conf and added the recommended lines:
MaxRequestLen 2147483648
FcgidMaxRequestInMem 2147483648
Which covers the earlier version of fastcgi with the MaxRequestLen entry and newer modules with the FcgidMaxRequestInMem entry, both of which were set to around 2Gb.
Did the same with the vhost.conf file located in /var/www/vhosts/system/domain-name/
adding the following block:
<IfModule mod_fcgid.c>
MaxRequestLen 2147483648
FcgidMaxRequestLen 2147483648
</IfModule>
again covering both sets of bases by declaring the values to be in excess of the limit in the error.
Nothing, still getting the upload error with the same old:
[warn] [client ip address] mod_fcgid: HTTP request length 134220467 (so far) exceeds MaxRequestLen (134217728), referer: name of script running the upload
OK so what the hell is going on here? I'm restarting apache and even the nginx and psa services to make sure it's bringing the new configurations online.
Back to the php.ini file, showed the localised settings were all working fine.
Time to get to grips with grep - seeing that the value we were all the same I ran a grep command to see where within the main system settings there was an occurance of this value:
grep -r "134217728" /etc/ which will recursively search for all occurances of the phrase "134217728" in all files.
Lo and behold!
I see a new entry which is located in /etc/httpd/conf/plesk.conf.d/ip_default/ called
domain-name.conf (e.g. abc.com.conf)
Opening this I see that there are two lines within the conf file which read:
<IfModule mod_fcgid.c>
FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/transcription.1stclass.uk.com/etc/php.ini
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
FcgidMaxRequestLen 134217728
</IfModule>
and a second and apparently duplicate entry:
<IfModule mod_fcgid.c>
FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/transcription.1stclass.uk.com/etc/php.ini
FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
FcgidMaxRequestLen 134217728
</IfModule>
Modifying the red text entries to be 2147483648 and restarting apache
service httpd restart enabled us to upload large files.
So, lesson learned, if you are using Parallels Plesk Control Panel and need to change a commonly used entry, do yourself a favour and use grep to locate localised (or Plesk controlled) versions of module configurations - it's better than ploughing through 100s of Google searches (none of which suggested this at all!!)
Happy Grepping!
No comments:
Post a Comment