Hi all,
After switching to a Webmin box, I recently noticed a huge drop in sales on a couple of our sites.
After much poking around I realize the orders are taking an eternity to complete. I assumed it was because curl_process was getting pokey due to the card processor, but, even when I eliminated that as the source of the problem, the orders were still not completing in a reasonable amount of time.
It turns out that outgoing mail notifications were where it was getting stuck
mail("$email", "$greeting", $message2, "From: $store_from_addy\nReply-To: $store_from_addy\nX-Mailer: PHP/" . phpversion());
and other similar commands are taking an eternity to process > 1 minute.
This box is configured with sendmail, not postfix.
My guess? php is configured to wait for sendmail to deliver the mail before returning success or failure.
Assuming my guess sounds reasonable to you, how can I get php to stop waiting for sendmail? Otherwise, do you have a better guess?
My two thoughts are --
1. Look in both the Apache error_log for that domain, as well as the mail log, for any signs of problems.
2. If nothing shows up in #1, try to re-create the problem in a new, small script that does nothing but attempt to send an email. A test case. And fiddle around with this test case until you can get the hang of what's going awry.
PHP should be able to send an email, whether it's with Postfix or Sendmail, so re-creating the problem a small test case should hopefully help you nail down what's going wrong.
-Eric
DNS is fast and reliable on our systems, and I've turned host name lookups off anywhere they were obvious to me, as well.
I am practically certain the mail command is the problem, because I pretty much commented out everything of consequence in the original script... plus the exact same script works with good speed on the CentOS box - which is PostFix based.
I will, just the same, create a tiny test script just to say I covered all bases... but I'm nearly convinced at this point that it's a PHP and/or Sendmail thing, and I either need to add some new flag to sendmail's path /usr/bin/sendmail -t -i -DONTWAIT (er whatever it is on this box) or alter php.ini somewhere to forget about waiting, OR, use some special command like the "@" symbol to tell php not to wait., ie ?mail("somebody", "message").
Because of my confidence, I'm going to post this over at PHPBuilder as well, while simultaneously admitting that I probably pushed the "wait 3 minutes before returning from a mail command button" somewhere... hehe
So, did I miss where you checked the maillog for clues?
--
Check out the forum guidelines!
Whenever anything is slow, I always want to blame DNS. Is DNS fast and reliable on your system?
--
Check out the forum guidelines!
The problem was that I never truly resolved the problems I was having with sendmail getting mail out at all... I had to explicitly allow relay to the domains in question in the smtp setup as a temporary fix and will figure it out later.
Thanks for your good guesses.