Akismet is a great comment spam catching service provided by wordpress.com. I use an external PHP client to test the comment or contact form spam in my sites and it had been working great. Only recently, I noticed that sometimes I receive several same message from the contact form from the same user. Originally I thought it must have been some “annoying” users who sent multiple identical messages to get noticed, but when the number of cases increased, it became an issue to invest.
After some tryouts myself it turned out the submission of a contact form was painfully slow. The users must had been refreshing the page in frustration of the slow response. And the cause was the Akismet client, which took about 40-60 seconds to return. Naturally I checked the web to see if this had been an issue to this other people. Although the information was sparse, there are a couple of solutions, and both works.
1. Upgrde the Akismet client
I use PHP5 Akismet client by Alex, and sure enough there is a new version (0.4) that addresses this issue. A more detailed test by Jan De Poorter can be found here. So by changing HTTP version back to 1.0 fixed the issue.
2. Modify the HTTP request
But why the newer and better HTTP 1.1 had problem? One of the big improvement in HTTP/1.1 is the capability to handle the persistent connection. In a nutshell, a client can keep the TCP connection open in HTTP/1.1 and use the same connection for the subsequent requests to save the resource by not opening new connection each time. Sounds promising right? However, this makes the client to be responsible to close the connection since the server would not have any idea when it’s done. If a client does not wish to handle it, it must specify “Connection: close” in the http header and tells the server that this request SHOULD NOT be considered persistent after the current request/response is complete.
If you use PHP5 Akismet client and want to stick with HTTP/1.1, you can add this in the http_post function:
$http_request .= “Connection: Close\r\n”;
Which will also fix the performance problem.
Start from yesterday I noticed some changes with my iGoogle page.
iGoogle is my personalized home page that has all my gadgets on one page for quick access, for example, RSS reader, Gmail, Calendar, etc. One noticeable changes is that the “Home” tab is moved to the left of the screen, with a gadget menu drop down. From the new “Home menu”, I’ll be able to open the reader or Gmail on the same iGoogle page without having to deal with a new browser window (or tab).
It takes me a little getting used to at the beginning. The new menu on the left takes up some space and the home view is definitely squeezed in this design. Plus, some of the functionality changes the behavior so I had to adjust. After a little while I started to feel the convenience.
I guess this is another step toward a browser desktop from Google. The Home menu definitely reminds me of the Windows start menu or the dashboard on Mac OS. With more and more gadgets (application) released to the wild, iGoogle can become very useful if you like Google’s product.
Alias module in Apache http server provides an easy way to map a URL path to a local file directory. For example, the popular MySQL web access tool phpMyAdmin is often installed as a alias in the Apache web server. Usually a line of code like this will do the trick:
alias /phpMyAdmin “/my/directory/phpMyAdmin”
Recently I tried to setup a new server in the same way but kept getting 403 forbidden (You don’t have permission to access /phpMyAdmin on this server) message from the web server. Thinking that this must have been some trivial issue like a typo, it turned out to be a long troubleshooting process. Finally I figured out the couple of things that needed to be fixed:
First, the directory access permission needs to be set up correctly.
The default directory access permission is usually set pretty strict. It looks like this:
Deny from all
It provides good security but also prevents the access to the others. So we’ll have to re-configure the directory that is mapped to an alias (Same should be done for the virtual server as well). So adding this into the httpd.conf will make it better:
Options All -Indexes
Allow from all
However, I was still getting the error: You don’t have permission to access /phpMyAdmin on this server, which was quite puzzling since I was pretty sure I was on the right track.
Now this time even the error message was the same it was a different cause. Since I disallowed file listing on the directory (-Indexes) Apache refused to server the URI …/phpMyAdmin. All I needed to do was to add index.php to the DirectoryIndex directive so Apache knows what to display when a directory name is requested. Of course …/phpMyAdmin/index.php would also work without the change.
A seemingly small problem caused me a lot of time to fix.