How do I increase PHP request length (FastCGI/CGI) to upload larger images?

April 19, 2016 383 views
PHP Apache WordPress Ubuntu

I am using the One-Click Wordpress Image.

I have been unable to upload images to wordpress that are larger than ~128KB. I've tried various fixes and suggestions from an outside community from bypassing security features on .htaccess to playing with memory limits on php.ini but to no avail-

However, I do note that the similarities of my issue bare very closely to PHP using FastCGI module, which defaults the HTTP request length to 128KB.

So I think this is where my problem lies since I seem to be unable to upload images from about 100~KB onwards

Unfortunately- I can't find anywhere in my /apache2 and /php5 folder the existence of such module. Only CGI module seems to exist in the mods-available, so it isn't enabled at all.

Some notes:

I do not get flagged for error on console or on the dashboard during upload. It just hits a certain percentage really quickly and never moves. The smaller the image size the higher the percentage uploaded before stalling.

2 Answers

I'd like to update that it turns out I am able to upload any and all images using Microsoft Edge browser- and not Chrome and Firefox.

Which is a glimmer of hope yet.

The PHP FastCGI set up works by running a few PHP workers as their own processes and having Apache communicate with them through the FastCGI protocol, instead of Apache running php as part of its own workers. Create a file in your document root with the following contents:


Once you browse to it, you will see a list with PHP's configuration options. Check the following options and see if the changes that you made took effect.

  • uploadmaxfilesize
  • postmaxsize

If not, you will need to edit /etc/php5/fpm/php.ini accordingly.

Don't forget to restart the php5-fpm service after editing the config files. I would also recommend checking php's error logs and seeing if that have any errors.

  • /var/log/apache2/error.log
  • /var/log/upstart/php5-fpm.log
Have another answer? Share your knowledge.