/etc/hosts weekend

"

This weekend I spent much time figuring out one annoying issue. In a nutshell, my server has been experiencing strange slowness issues. Some certain .php pages were taking consistently between 1.01 and 1.09 minutes to respond. At some point I found a pattern — it happened only on those pages that had drupal_mail() or php native mail() function.

So I went ahead and tail -f /var/log/mail.err it to find the following:

Jan 25 11:40:01 sms sm-msp-queue[6272]: My unqualified host name (localhost) unknown; sleeping for retry
Jan 25 11:41:01 sms sm-msp-queue[6272]: unable to qualify my own domain name (localhost) -- using short name
Jan 25 11:53:17 sms sendmail[6276]: My unqualified host name (localhost) unknown; sleeping for retry
Jan 25 11:54:17 sms sendmail[6276]: unable to qualify my own domain name (localhost) -- using short name

I found similar problems reported on ubuntuforums.org — Sendmail Hostname Issue - Appears to be a common though difficult issue. Unfortunately, that discussion has been archived so I cannot post my response there.

After reading online about this for a bit, my solution was simple. I realised that my /etc/hosts file is not correctly constructed. The order for host names for 127.0.0.1 matters. Therefore, I had to shuffle names in such order where first comes actual host unique name, then 'localhost localhost.localdomain', then domain name itself as shown below:

127.0.0.1       vladserver localhost localhost.localdomain f1vlad.com www.f1vlad.com

This simple fix solves the issue. I think the following will be useful to know as well:

# cat php.ini | grep l_p
; sendmail_path =
sendmail_path =/usr/sbin/sendmail -t -i
|