Fixing WordPress comment email notification problem by installing sendmail on Debian

In the past, whenever a reader commented on a blog entry, I would receive an email notification. Ever since I moved this site to a Linode VM, I noticed the comment email notification stopped working. Alas, blogs are not like what they used to be back in the day, now that so many people have mobile devices and there are so many ways to waste our time. As a result, not too many people bother to comment on blogs these days. So I postponed fixing this until today.

It turns out that WordPress uses PHPMailer for email notification. Skimming through the source code of wp-includes/class-phpmailer.php, I determined that installing sendmail on my Debian VM would fix the problem.

But sudo apt-get install sendmail gave me this first:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 sendmail : Depends: sendmail-bin but it is not going to be installed
            Depends: sensible-mda but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Ok, let’s fix the broken packages then:

sudo apt-get -f install

That didn’t find any broken package to fix.

So I decided to install the dependencies separately. First:

sudo apt-get install sendmail-bin

That command generated some error output but the last message was ok:

Errors in generating
*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`always_add_domain')*** ERROR: FEATURE() should be before MAILER()
*** MAILER(`local') must appear after FEATURE(`allmasquerade')*** ERROR: FEATURE() should be before MAILER()

[ ok ] Starting Mail Transport Agent (MTA): sendmail.

So I proceeded with:

sudo apt-get install sensible-mda
sudo apt-get install sendmail

Both commands were successful. I then tested sending email to myself on the command with mail, which worked fine. A test comment on my blog also resulted an email notification. So all is well.

Hope this helps you also!

Web hosting with DNSimple and Linode

After about 8 years of hosting this site with Midphase, I’ve migrated my hosting service to Linode. I am using Debian 7 as my operating system. The web server is Tengine, a fork of Nginx. (Update: I am currently using Apache.) I have root access, therefore total control of this Linode VM. And I am using DNSimple to manage my domain, which is also very nice.

Apart from having total control of the server, I found Linode’s documentation to be pretty clear and easy to follow. I am currently on the Linode 1GB plan, which works very well so far for this WordPress site. It also hosts another site, JiMetrics hosts an open source project to gather and analyze system metrics data, initially focusing on Windows server and SQL Server administration. I recommend Linode highly. If you do want to use Linode service, I’d appreciate it if you could use my referral code so I could get some credit, 26cf3677a198d39b0728077d04c74651b0ee93c6

Most of web hosting companies bundle domain name service along with hosting service. Depending on your situation and technical knowledge, this may or may not be a good thing. I prefer separating those two nowadays, which gives me more flexibility and better control, especially when it comes down to moving hosting service somewhere else, due to lack of support and/or deteriorating performance. So for DNS, I’ve decided to use DNSimple. It has a pretty good interface and documentation. With the fixed IP address I get from Linode, I just filled out the appropriate information in my DNSimple accout for domain name resolution. I am pretty happy with it so far. Once again, if you do decide to use DNSimple, I’d appreciate it if you use my referral link so I can get some credit.

Keep up the good work, Linode and DNSimple. Don’t disappoint me and the good folks I send your way.

Setting up WordPress on Debian/Ubuntu running Tengine web server

I will change my host provider within a month. I’ve been using Midphase for several years and have decided to use Linode as my next virtual private service provider. I will move this site there in the next few weeks. This will be my first time moving a domain and I hope the transfer will be smooth without too much down time. After all, I know my readers worldwide are hanging on to every word I type and deserve a site that runs 24 by 7 🙂

Since I will have total control of this host, I decided to use Tengine, a great fork of the Nginx web/proxy server. Here is my note on how to compile and config Tengine on Debian/Ubuntu, and then setup WordPress. During my study and testing, the following sites are pretty helpful.

I followed and modified processes from all 3 sites above and made my own. It works for me so far. It is documented here and I will modify it as necessary. Right now the Tengine server only hosts one domain. I will very likely add more domains down the road. I’d love to hear your comments and recommendations. One thing that is not documented here is the installation of WordPress SuperCache plugin. I plan to use that after the site is moved.

sudo apt-get update
sudo apt-get upgrade --show-upgraded
sudo apt-get install libpcre3-dev build-essential libssl-dev
tar xzf tengine-1.5.1.tar.gz 
cd tengine-1.5.1/
./configure --user=www-data --group=www-data --with-http_ssl_module
sudo make install

sudo vim /etc/init.d/nginx
Please copy and paste code from here for /etc/init.d/nginx

sudo chmod +x /etc/init.d/nginx 
sudo update-rc.d nginx defaults
sudo /etc/init.d/nginx start
sudo apt-get install php5-cli php5-cgi spawn-fcgi psmisc
sudo apt-get install mysql-server php5-mysql

sudo vim /etc/php5/cli/php.ini
Please uncomment this line in /etc/php5/cli/php.ini. It should be around line 944.


sudo vim /usr/bin/php-fastcgi
Please copy and paste code from here for /usr/bin/php-fastcgi

sudo vim /etc/init.d/php-fastcgi
Please copy and paste code from here for /etc/init.d/php-fastcgi

sudo chmod +x /usr/bin/php-fastcgi 
sudo chmod +x /etc/init.d/php-fastcgi 

Create an empty MySQL database

tar xzf latest.tar.gz 
sudo mkdir -p /var/www
sudo cp -r wordpress/* /var/www
sudo chown -R www-data:www-data /var/www/
sudo update-rc.d php-fastcgi defaults

sudo vim /usr/local/nginx/conf/nginx.conf
Please copy and paste code from here for /usr/local/nginx/conf/nginx.conf

sudo /etc/init.d/php-fastcgi start
sudo /etc/init.d/nginx reload

Now go to http://localhost and your test WordPress site should be ready to go.

Thinking of changing hosting company

I purchased shared hosting service from Midphase years ago and that is where this site is hosted. It is up for renewal before 10/11.

Every year during this time, for the last 2 or 3 years, I toyed with the idea of switching to a different hosting company, because the inflexibility of not having root access. The current annual price from Midphase is around $136 with this breakdown: (MPan) $96 and DevPack – Unlimited MySQL & Subdomains $40. Here is some server specs:

# Percona Toolkit System Summary Report ######################
        Date | 2012-09-27 21:13:49 UTC (local TZ: MDT -0600)
    Hostname | some server name
      Uptime | 197 days, 12:31,  1 user,  load average: 5.87, 4.95, 4.89
    Platform | Linux
     Release | CloudLinux Server release 5.8
      Kernel | 2.6.18-374.18.1.el5.lve0.8.57
Architecture | CPU = 64-bit, OS = 64-bit
   Threading | NPTL 2.5
    Compiler | GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-52).
     SELinux | Disabled
 Virtualized | No virtualization detected
# Processor ##################################################
  Processors | physical = 1, cores = 8, virtual = 1, hyperthreading = no
      Speeds | 1x2400.000
      Models | 1xAMD Opteron(tm) Processor 6136
      Caches | 1x512 KB
# Memory #####################################################
       Total | 15.5G
        Free | 500.9M
        Used | physical = 15.0G, swap allocated = 4.0G, swap used = 397.2M, virtual = 15.4G
     Buffers | 835.2M
      Caches | 5.3G
       Dirty | 254020 kB
     UsedRSS | 18.6G
  Swappiness | 0
 DirtyPolicy | 10, 80
 DirtyStatus | 0, 0

I looked at some Virtual Private System (VPS) providers. Linode’s smallest offering, Linode 512, provides 512MB of RAM and 20 gig of storage at a cost of $20 per month. NTC Hosting’s VPS Hosting vBox 1 provides 1 gig of RAM and 10 gig of storage at a cost of $20 per month. I’ve also browsed Rackspace, InMotion, and others. I don’t know, if I do decide to go with VPS, I will probably pick between Linode and NTC Hosting. Either way, it looks I need to pay $100 extra per year if I go that route. And I need to transfer domain name, which I’ve never done before. There is also the factor if my site is still accessible in China if I change hosting companies…

Anyway, if you have any recommendations on hosting service providers and comments, I am all ears.






1. 目前国际上交流的载体大部分是英文,所以不少人在这方面会有障碍。但不要因为有了这个障碍就不敢交流,不要因为害怕病句、拼写的错误而放弃交流。你当然要努力尽量用正确的词和句法,但如果词和语法不完美和正确但意思到了,那么这个交流就很有意义。这样一来二去,你的外语水平会提高。在本文的最后我有提高英语的小建议。另外,其他参与到开源软件的人可能来自非英语国家,他们的英语不见得比你强到哪里去;

2. 要注意名字的拼写。一般来讲,别人怎样自称,你就要用那种拼写方式,包括字母的大小写。我看到一些从国内来的电邮,其中有的不知何故的改变别人名字的大小写,请不要这样做;

3. 无论是书面还是口头交流,千万不要不懂装懂!如果你没搞明白,如果这个事情不是鸡毛蒜皮之类的小事,特别是牵扯到计划、行动、和时间安排等对他人有直接和间接影响的信息,不要敷衍了事!你没搞明白,你可以说,对不起,你可以换一种方式来解释吗?或者你可以以你的理解方式复述重要的交流信息,以此来确认和验证彼此观点和计划的一致性。千万不要在双方还没真正达成一致的情况下拍胸脯、打包票,结果损人损己;

4. 口语交流上,不要太在乎口音。能表述清楚是第一要务,所以说的时候不要着急。一般来讲说慢些会有利于理解;

5. 哈哈一笑是比较常见的沟通方式,也是化解矛盾、将就着过去的方法。另外,我们中的不少人和国际友人交流的机会不多,有好奇心甚至觉得国际友人的举止比较可爱的情况很正常。再加上语言的不便,这种有点紧张的笑声就更容易听到。但我感觉在大多数情况下,国际友人,特别是不太了解东方文化的,可能会以为这种笑对他们来讲有点奇怪甚至难以理解。这不是说面对面沟通或打电话交流时不能笑,大家都板着脸。重要的是能察言观色,观看肢体语言和表情,这方面我感觉东西方的差别不大,并根据这些观察来调整和理清模糊的观点。有些东西,一次解释不清不要紧,以后时机成熟时再提也不迟;

6. 对外交流增多,有很多人来中国,我们要逐渐适应、学习、尊重、和欣赏他们所带来的多样性和多元化。举个小例子,面对面交流时,我们尊重别人的饮食习惯,有人吃素,有人不习惯吃整的带刺儿的鱼等等。尊重别人的时间和空间,有计划并及时沟通;

7. 既然我们都是人,那么国际人士和国内同胞一样,也不乏混蛋、瘪三、种族主义者、圣人蛋、猥琐的小人混蛋之流。再加上事情的偶然性、沟通障碍、不合宜的时机等,有的项目即使我们做得很好,也可能因为各种各样的因素,我们的patch,feature set等不被接纳。在这种情况下,在合作的努力没有结果后,我们可以发布自己的分支和大家共享和进步。




我认为过了六级英语的同学没必要通过读报纸和杂志英语新闻来提高,因那都是肤浅空泛的八股句式,搞得人很浮躁和浮漂,蜻蜓点水一样,内功提不上去,个别的长的深度报导除外。我不是开玩笑,我觉得读《洋葱》(The Onion)学英语要比读NYT,The Wall Street Journal,Time Magazine,Newsweek等更有效和有趣。National Geographic还行,但质量也在下滑。最好是读书,安静一下,每周找个时间,沉下心来,给自己放个假,读本好书,陶冶性情,平稳而满足。在《洋葱》那里你可以逐渐理解部分美式的幽默和讽刺!祝学得愉快!