1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Image upload (resize) not working on nginx/php-fpm

Discussion in 'Troubleshooting and Problems' started by Espen Espelund, Sep 1, 2011.

  1. Espen Espelund

    Espen Espelund Active Member

    For some reason I can't upload large images on my nginx/php-fpm setup. The problem seems related to resolution and not just filesize. A 1000x1000px 10kb image does not work. Everything works fine in WordPress with the same setup.

    Did anyone experience a similar problem?

     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Presumably you've set the necessary limits in the ACP?

    Why can't I upload an image, even though it is smaller than the maximum dimensions (pixels) permitted?
    Server-side file size (KB) resizing is not supported. Any files which are larger than the maximum size specified in theACP -> Options -> Attachments: Maximum Attachment File Size (KB) will be rejected.

    Why can I upload an image, even though it is larger than the maximum file size (KB) permitted?
    Uploaded files are first resized based on the maximum physical dimensions (pixels) set in the ACP -> Options -> Attachments: Maximum Attachment Image Dimensions. If the resized image is below the maximum file size (KB) limit, then it will be allowed.

    http://xenforo.com/community/threads/frequently-asked-questions.5183/#post-180445
     
  3. Espen Espelund

    Espen Espelund Active Member

    Yup, not the problem. The uploader will simply stop at 100% and I get an error in the server log.

     
  4. Mike

    Mike XenForo Developer Staff Member

  5. Espen Espelund

    Espen Espelund Active Member

    Tried setting
    Code:
    request_slowlog_timeout = 60
    slowlog = /var/log/php-fpm-slow.log
    The error still appears pretty much instantly, so I don't think its timing out

    php-fpm.log (time not related to the upload)
     
  6. Luke F

    Luke F Well-Known Member

    Code:
    fastcgi_pass_request_body off;
    client_body_in_file_only clean;
    fastcgi_param  REQUEST_BODY_FILE  $request_body_file; 
    With this nginx will handle the uploads, then pass the completed upload to PHP-FPM. Works great here :)
     
    RoldanLT, Brogan and Mike like this.
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Hehe, I was waiting for DI to chip in :)
     
  8. Espen Espelund

    Espen Espelund Active Member

  9. Luke F

    Luke F Well-Known Member

    I've always run the two under the same account, can't you just do that?
     
  10. Espen Espelund

    Espen Espelund Active Member

    Looking into it now with the server management guy. Pretty big job to make that switch I guess, but we might end up doing it
     
  11. Luke F

    Luke F Well-Known Member

    It should be just a matter of changing user/group in php-fpm.conf
     
  12. Espen Espelund

    Espen Espelund Active Member

    yea but we're spawning new processes for every user with open_basedir for a bit of extra security. I'm sure it can be turned back in a reasonable amout of time
     
  13. Luke F

    Luke F Well-Known Member

    Oh I just run separate pools for each user under their account
     
  14. Espen Espelund

    Espen Espelund Active Member

    We switched it to the nobody user with the configuration above, but still get the same segfault from php-fpm. So the new config is working, but it's still crashing.
     
  15. Mike

    Mike XenForo Developer Staff Member

    I wonder if it's just plain PHP crashing, perhaps due to a memory issue? All I can really think of. 1000x1000 isn't a particularly large image though. Just to confirm, can you try the non-flash uploader? Additionally, if you disable JavaScript in your browser, it may give you some more info (though I suppose if PHP is crashing, we're not going to get any info from it...).
     
  16. Luke F

    Luke F Well-Known Member

    Are you on the latest PHP release and is it from official repos or self-compiled?
     
  17. Espen Espelund

    Espen Espelund Active Member


    I get a 502 Bad Gateway, more or less sure it's php crashing. I'll have to check with management Darkimmortal
     
  18. Espen Espelund

    Espen Espelund Active Member

    Self compiled 5.3.6
     
  19. Luke F

    Luke F Well-Known Member

    That'll be where the issue lies then, fiddle with the compile flags and libraries until make test works
     
  20. Espen Espelund

    Espen Espelund Active Member

    Not exactly sure I know what you mean. Php is working fine for everything else on the forum and WordPress
     

Share This Page