4
votes

I have a PHP 5.5 application running on Google App Engine. It's based on the CodeIgniter framework. Recently I started needing to upload files more than 8 MB.

I have been getting the following error

PHP Warning:  POST Content-Length of 8501809 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 

I edited php.ini (which is in the same directory as app.yaml), but it doesn't seem to impact the maximum upload size.

post_max_size = "16M"
upload_max_filesize = "16M"
memory_limit = "128M"

Is there somewhere else I should be setting the max_size? Any other fields?

Thanks!

3
Solved! It turns out I had mixed and matched colons and equal sings in my php.ini file, and it was not formed properly. - Will Shepherdson

3 Answers

1
votes

The PHP runtime Directives documentation may be useful. As you indicated, php.ini file should be in the same directory as your app.yaml. I'd sugest specifically looking at the file_uploads and max_file_uploads values. (Note that the default for each is 0, try setting it to 1).

2
votes

I'm using this in my .htaccess file (this works well on shared hosting where you might not be able to change php.ini):

## I need more memory to upload large image
<IfModule mod_php5.c>
  php_value memory_limit 256M
  php_value post_max_size 50M
  php_value upload_max_filesize 50M
</IfModule>

further: in Codeigniter you can set filesize preference in your config.php file: see here

1
votes

I added below in php.ini (same place where app.yaml is located) it worked

post_max_size = &quot;16M&quot;
upload_max_filesize = &quot;16M&quot;
memory_limit = &quot;128M&quot;