{"id":203,"date":"2012-06-23T15:07:18","date_gmt":"2012-06-23T20:07:18","guid":{"rendered":"http:\/\/jamesroberts.name\/blog\/?p=203"},"modified":"2012-06-23T15:08:35","modified_gmt":"2012-06-23T20:08:35","slug":"php-sendmail-90-second-delay-on-dotcloud-solved","status":"publish","type":"post","link":"https:\/\/jamesroberts.name\/blog\/2012\/06\/23\/php-sendmail-90-second-delay-on-dotcloud-solved\/","title":{"rendered":"PHP sendmail 90 second delay on Dotcloud [solved]"},"content":{"rendered":"<p>For months we have been having upstream timeout issues with our Dotcloud PHP service running nginx and php-fpm. \u00a0Amongst other causes, we found that after our instances were up for more than a day, php&#8217;s mail function using sendmail was consistantly taking exactly 90 seconds to send an email. \u00a0Unacceptable.<\/p>\n<p>After going back and forth with Dotcloud&#8217;s support, we determined that sendmail was spawning 3 processes to send emails, and apparently on their boxes, it takes 30 seconds to spawn a new process. \u00a0Seems like it shouldn&#8217;t take that long, but it does. \u00a0The solution to this issue was to simply not use sendmail. \u00a0Instead, we are using SMTP protocol to talk to postfix locally on a php instance. \u00a0Originally I wanted to avoid sending emails via SMTP because it can be slow when authenticating to a remote server. \u00a0Because we are using SMTP locally with no authentication it is very fast.<\/p>\n<p>In short, <strong>DO NOT USE sendmail on DotCloud PHP instances <\/strong>or it will cause all kinds of problems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For months we have been having upstream timeout issues with our Dotcloud PHP service running nginx and php-fpm. \u00a0Amongst other causes, we found that after our instances were up for more than a day, php&#8217;s mail function using sendmail was consistantly taking exactly 90 seconds to send an email. \u00a0Unacceptable. After going back and forth [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[51,55,62,56],"_links":{"self":[{"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/posts\/203"}],"collection":[{"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/comments?post=203"}],"version-history":[{"count":3,"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/posts\/203\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/media?parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/categories?post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jamesroberts.name\/blog\/wp-json\/wp\/v2\/tags?post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}