Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running php-fpm on nginx

I have my php.ini values set as follows

upload_max_filesize = 100M
post_max_size = 128M
max_execution_time = 180

I have also set my client_max_body_size to 4G. When I try small uploads they work, but when I try a big upload of say 35M I get a 502 and when I look through the logs I see ,

upstream sent unexpected FastCGI record: 3 while reading response header from upstream

Any ideas? I've tried the nginx threads but they don't really help.

Thanks in advance

share|improve this question
    
You need to check the PHP error logs. –  Michael Hampton Oct 23 '12 at 0:51
    
@MichaelHampton I checked my logs and though I have all ini parameters related to logs turned on, I don't see any errors in my php-fpm.log file. Can you tell me what I'm missing? –  ryan Oct 23 '12 at 1:08
    
that's probably not where errors are logged. Check your php.ini to see if you even have logging enabled. –  Michael Hampton Oct 23 '12 at 1:09
    
@MichaelHampton, log_errors = On and error_log = /var/log/php.log EDIT: php-fpm logs are also turned on and I find this on that " WARNING: [pool www] child 920 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 39277825 bytes) in Unknown on line 0" No error logs in php.log –  ryan Oct 23 '12 at 1:18
    
@MichaelHampton, I was trying a file of size 35M and so I'd set the memory_limit to 64M. Looks like irrespective of what the actual uplaod is, the memory_limit needs to be higher than max_upload_filesize. TIL. Thanks! –  ryan Oct 23 '12 at 1:29

1 Answer 1

up vote 2 down vote accepted

First step: ensure you have error logging enabled in php.ini and check the log entries.

From your log entry:

WARNING: [pool www] child 920 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 39277825 bytes) in Unknown on line 0"

It appears PHP has run out of memory processing the uploaded file. You will need to increase the memory_limit parameter. Further information on upload tuning can be found at the PHP web site.

share|improve this answer
    
Thanks for the upload pitfalls link. –  ryan Oct 23 '12 at 1:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.