ifconfig eth0 shows packet errors

Just a quick note on problem I came up against today.
I monitor one of my production servers (running Ubuntu 7.10 server) with Munin and through this I had noticed a lot of errors on network interface eth0.

I had a quick look with ifconfig eth0 to see what was going on. These were the lines of interest from the output:

RX packets:404933416 errors:0 dropped:0 overruns:0 frame:0
TX packets:501341708 errors:31383248 dropped:0 overruns:11 carrier:62766496

Obviously something is not right.
I spent a while reading through log files to no avail, this isn’t really my area of expertise so I gave in and contacted my hosting provider.
Continue reading

Unable to find a $JAVA_HOME at … on Mac OSX

I recently switched my Java versions from 1.5 to 1.6 and I’ve been hitting some issues with the java path.
I tried setting the environment variable JAVA_HOME=/usr and that worked for some stuff but I still saw this error when running java.
>java -version
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java

I solved the problem by doing the following.
First I found out where java actually was with:
>ls -l' `which java`
/usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

I noticed a command called java_home in that same directory. Running that command yields the correct java home directory.

To correctly set the my JAVA_HOME environment variable in future, I added the following to my ~/.profile

export JAVA_HOME=`/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home`

Once you have done this you can restart your terminal window or run >. ~/.profile to reload you profile into the current terminal session.

Getting WP-Super-Cache to work with WordPress on Nginx

I was setting up WP-Super-Cache yesterday when I ran into this gotcha, I’ve done this before so I should have known better, I’m blogging it now so that I don’t forget and anyone else with this issue can be saved some hassle.

Essentially WP-Super-Cache was only half on, it could generate wp-cache files but was not creating static cache files.  The reason for this was that the querystring always contained at least one value even though it wasn’t in my URLs. That drove me crazy until I remembered this morning that the recommended Nginx setup was the problem the last time. The reason for this is the following part of the Nginx config that rewrites any non existing file requests to WordPress’ index.php

if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;

This will cause WP-Super-Cache to never generate any static cache files since one of its conditions for doing so is that the querystring is empty.
If your Nginx config has this, try changing removing the ?q=$1 as below:

if (!-e $request_filename) {
rewrite ^(.+)$ /index.php last;