+2 votes
in Web & Google by (15.2k points)
edited by

I am running Apache2 + Nginx1.17 on Ubuntu 18.4. The PHP version is 7.2. I am facing a problem when I try to upload any file larger than 128KB using a PHP script. I increased the value for upload_max_filesize and post_max_size to 64M, but it did not solve the problem. How can I fix the error?

post_max_size = 64M

upload_max_filesize = 64M

1 Answer

0 votes
by (25.6k points)
edited by

You need to change the value for "FcgidMaxRequestLen". The default value for this field is 128kb and hence you get "Internal server error" when you try to upload any file > 128kb.

To change the value, edit the file "fcgid.conf".

1. If you do not know the location of "fcgid.conf" on your system, run the following command to get the location of the file.

find / -type f -name "fcgid.conf"

2. Edit the file using your editor. E.g.

nano /path_to_fcgid_conf/fcgid.conf

3. Add "FcgidMaxRequestLen 268435456" (128mb) to the file. You can set it to any desired value.

<IfModule mod_fcgid.c>
  FcgidMaxRequestLen 268435456

4. Restart web servers. e.g. Apache, Nginx