<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1114119085333160&amp;ev=PageView&amp;noscript=1">


If you're experiencing gateway timeouts (HTTP error 504) when using the Magento image upload/media manager or other CMS functionality, it may be because the server can't resolve its own domain name. Test this from the server's command line by trying to 'curl' a file via the site's externally-accessible domain name:

curl -o /dev/null http://www.domain.com/image.png

Magento uses the gd library to directly obtain image details from the URL of the image, rather than the local file system path, so if it can't connect the php-fpm gateway is likely to timeout (504 error).

Magento should log the errors in its var/log/system.log or var/log/exception.log files.

A useful way of debugging php-fpm gateway timeouts in general is to enable the php-fpm slow log in the pool configuration file (usually /etc/php5/fpm/pool.d/www.conf):

slowlog = /var/log/php-slow.log
request_slowlog_timeout = 30

If you then re-create the timeout and check the slow log file, it should give you a 'stack trace' showing the line of PHP source which caused the problem.

About the author

Rick Steckles
Rick Steckles
Rick has been with CTI since 2004, initially as a developer and subsequently as technical director. He has built up experience in a broad range of areas by working on a wide variety of projects. He is responsible for CTI's development infrastructure - continuous integration, code repository management, development and live hosting environments. Rick's primary focus is on delivering quality solutions which solve real problems in a simple, effective manner.

Get the latest content directly to your inbox


Recent posts