Search code examples
phpnginxfpm

ubuntu 14.04 nginx php5-fpm large file upload issue


Sending files of over approx. 5MB errors on my server - error 1:

UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini

In the php script the line:

message_log( "attach: error[" . $_FILES["file"]["error"] . 
"] name[" . $_FILES["file"]["name"] .
"] type[" . $_FILES["file"]["type"] .
"] tmp_name[" . $_FILES["file"]["tmp_name"] .
"] size[" . $_FILES["file"]["size"] . "]" );

Gives:

2019-06-26 11:31:35: attach: error[1] name[IMG_E0304.JPG] type[] tmp_name[] size[0]

I have recently increased the following params from 5MB to 10MB:

/etc/nginx/nginx.conf:

client_max_body_size 10M;

/etc/php5/cli/php.ini:

upload_max_filesize = 10M post_max_size = 10M memory_limit = 256M

And restarted the services nginx and php5-fpm.

Command line php calls to ini_get confirm the values are set as I wish. And nginx is clearly passing something to php.

What gives?


Solution

  • You are not changing the php5-fpm ini file. Search for for fpm ini file and add your filesizes there.