Category Archives: Weirdness

Fixing problems in WordPress

So for a while now I have had this problem that whenever I go to my blog’s home page the browser tries to download the PHP file rather than the server turning that PHP code into the blog. I was thinking that it must be something wrong with a content-type setting, but everything seemed fine. Then I discovered this in /etc/apache2/mods-available/php5.conf:

<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>

What that actually means is that if the user home directory module is loaded and the page is being loaded from the user’s home directory (that’s the ~seth bit), then TURN OFF PHP!

So you can see why it wasn’t working. I assume that in some recent update to Apache or PHP there is some security concern that has caused a paranoid code maintainer to put in this draconian setting. Once I had commented that out, it was fine.

 

Then I needed to update to WordPress 3.1, that went fine as I have done it many times before. But then when I tried to load the homepage again, it was blank – the so called “White Screen of Death”!

I fiddled around with a few things that people had suggested – turning off plugins, changing themes, but none of them worked. What I decided to do was to start from scratch and not use my old wp-config.php. Once I opened up the new version of wp-config-sample.php I realised that there were a lot of things my old file (probably from WP 1.x) didn’t have in it. So I changed my database password and then put in my settings. Once I had done this, everything worked fine!

 

Tips and Stuff

I have recently moved to a new virtual server hosting provider, Linode have hosting centres in 4 locations in the US and allow you to pick which centre you would like your server in. They have a great web user interface and are cheaper than my previous provider, Slicehost. So now I am paying about half what I was for hosting. I have also got away with using a lot less memory for my virtual server, by implementing some different ways of getting around spam.

Realtime DNS Block Lists (DBL)

DBL’s store a list of known IP addresses which should not be trusted when receving mail, either they are IP’s assigned to home machines (DSL/Cable clients) or known spammers caught out by traps. There are a few DBL’s, but until now I have only been using one – Spamhaus, but sadly this doesn’t catch most spammers. I have now been through my configuration and included a few more DBL’s which are listed below. The advantage of this is that looking up an IP in a DBL is not processor or RAM intensive and does not require an external program – like Spamassasin. I have also implemented a few features in postfix which allow the looking up of hosts who try to exchange mail with my server, if the hostname they are giving doesn’t match their actual hostname or they have no A record or MX record for the domain they are using, postfix will end the connection.

smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unauth_pipelining,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
reject_rbl_client dnsbl.sorbs.net,
reject_rbl_client zen.spamhaus.org,
reject_rbl_client b.barracudacentral.org,
#reject_rbl_client t1.dnsbl.net.au,
reject_rbl_client dnsbl.njabl.org,
reject_rbl_client dnsbl.ahbl.org,
permit_mx_backup

It is very important that “permit_mx_backup” goes at the end, because I am finding that spammers will take advantage of backup MX servers to get their spam accepted in some way, which then causes a lot of dead return to sender messages in your queue later.

With the “reject_rbl_client” lines I have in this config, I don’t have to use Spamassasin or other spam anaylsis programs at presnt, the few spams I am getting are minimal and may have been things I accidentially signed up to in the past! t1.dnsbl.net.au was blocking Google Mail last night, which is why I have blocked it. barracudacentral.org requires that you sign up to use their service first.

Moving MySQL

I have to admit that I am no programmer; Systems Administration, Network Administration and troubleshooting come fairly easily to me, but programming has always passed me by. I have often just blindly copied something someone else has done to get by and I remember when I was young spending hours typing in source code from magazines to see try out programs and stuff!

So when it comes to SQL people say “well its not that hard, its mostly english!” but you have to remember the order things go in and weather a line needs a ; at the end, etc… I have tried to get into PHP and stuff, but I just get really bored and give up. I have a load of programming books on C and PHP if anyone is interested!

I use some SQL on my server – WordPress, which makes this blog work uses MySQL… but to keep it going I had to move it from my old server to my new one.

I followed the usual instructions, to backup your databases use:

mysqldump -u root -p --all-databases > database_backup.sql

And then to restore:

mysql -u root -p < database_backup.sql

Then presto and everything is back, but is it working? Well it might be a good idea to try:

/etc/init.d/mysql restart

Because when you import your old databases, you overwrite the passwords for the users that are stored in them. In the file /etc/mysql/debian.cnf there are settings for a user called debian-sys-maint which is setup when you install MySQL. A password is generated for this user and then stored in the file, when you import all databases you overwrite the users database which then overwites this password, causing debian-sys-maint to be unable to access the database and a failure when you try to start MySQL, although the daemon is running.

phpMyAdmin is your friend here, because you need no knowledge of SQL commands to go in and change the password for a user, therefore fixing this nasty problem! Once you’ve done that you can then use this command to stop MySQL (as /etc/init.d/mysql stop won’t work):

kill | cat `/var/run/mysqld/mysqld.pid`

Then go ahead and start MySQL as normal:

/etc/init.d/mysql start

Uninterruptible Power Supplies and their lack of Uninterruptible-ness

An Uninterruptible Power Supply or UPS is a big battery that will keep your computer running if the power goes off, it will also protect it from surges and incidents when the power dips to what it should be. They are very useful for when you need to move things around or if you have electricity that you have to pay for in advanced (and will therefore be switched off automatically if you have no credit).

I have had small UPS’s for a few years which are about enough to keep an average desktop PC going for about 10 mins if the power fails. However, I have recently had to start dealing with them at work, since we have moved away from Co-located hosting to hosting our servers at our office. When you are running UPS’s commerically, the need for power cannot be overstated – you need things to be as overkill as possible! Most UPS’s (anything designed for keeping more than just one PC going) will have overload detection and if the UPS detects an overload, it will start to shut itself down – because if the power were to be lost, the batteries could not take the load and the servers connected would not be able to shutdown gracefully.

However this means that mains power is lost to these connected servers and hence zap – no power… Well, in our case it means a 50% reduction in power as the servers have 2 PSU’s each which are redunant. However, it is not so easy to build redundancy into a network, and taking out the UPS that the network switches are connected to will take down the servers as they can’t talk to the outside world… resulting in my mobile phone ringing and someone giving me grief that they can’t do any work!

Teamed Network Cards are network cards that can run in pairs (or more) providing greater throughput or redundancy if they are connected to different switches (in different UPS’s!) however my employer apparently has little interest int he redundancy aspect of this and uses teaming only for throughput… why have 1Gb/s when you can have 2Gb/s?!

After this happening twice today, I had to bypass the UPS’s entirely as they were getting less reliable than the service from the electricity provider!

Whilst I like my job, I hate the fact that my employer prefers to buy his parts on eBay and expects great performance from a limited budget!

Well, I think that is all for tonight… until next time (in the imortal words of Sara Cox) – “rave safe kids, rave safe!”

Damm Motherboard

This is my motherboard, which is broken.

Where the red circle is, there should be a bit of plastic which sticks out, just like the one on the other side. These points allow you to clip the heatsink down onto the processor (the gray square), to ensure good contact between the two.

I contacted the company I brought it from, they have told me they will not take it back basically because they think I am a nube and broke it. I did not break it, it broke by itself. I have been building PC’s for 10 years and I have an A+ qualification. I DO know what I am doing!

So I have now contacted the manufacturer, who are supposedly regarded as one of the best motherboard manufacturers. I await to hear what they say. Even if they could send me a new plastic bit (its only held down with screws), that would be nice.

But being me – generally a very impatient person, I decided to get a new, but much cheaper motherboard, because I cannot stand the old PC I have, and don’t have any compatible parts to make the shiny new one – which I only built in September, work.

I’ll let you know what happens re the current motherboard. If anyone has a broken AM2 motherboard where that plastic part is intact and would like to give/sell it to me, please contact me.

An interesting day…

So this morning I go to see the optician, he tells me that my glasses from 2 years ago are still at the prescription I need, which is really good considering last year I saw another optician who told me they were too strong! I order new glasses because under the UK NHS system I am entitled to money towards new glasses every 2 years.

This evening was more about taking things apart, a friend of mine and Ed’s brings in a laptop to the TermiSoc tutorial that his housemate sat on… One of the guide rails for the DVD drive was bent, Ed and I took it apart to discover this, but there was very little we could do, albeit assure our friend that it would still work.

Then tonight after we got home, the whole house electricity kept tripping out every few minutes. After doing a test by turning on all the most power consuming appliances we have, we found we could not trip out the power. Then we turned on the tumble dryer, and it died! What I discovered after I had ruled out the socket and the extension cord was that the element that gets the dryer hot had somehow gotten wet and since electricity and water don’t mix, well better that we lost power than our whole house burnt down!

After I dried out the heater compartment and put it all back together it started working fine. So I guess there can’t be much wrong with it.

But I think to myself, why am I doing all this calculus and maths stuff when what I am good at is fixing stuff, with my hands… Give me a broken computer and I am happy for a few hours!

So now, at 1:20am I am finally going to bed! Tomorrow the Calculus starts!

Rave Safe Kids!

Seth out.

Cool Stuff

Simpons AvatarSo today, after weeks of waiting for Broadband in our new house, we (Ben, Ed and myself) finally got it!

We were intending to wait for Orange (a BT ADSL Service) to move my existing connection to my new line, but so far it has taken them 14 days to remove it from my old line! It could take up to 13 more days before we get it here!

After hearing this news on Tuesday I decided I had had enough and since the cable company (Virgin Media) are doing a deal where you can get a 2Mb service for £10 per month for 1 year (instead of £18/month) I went for it. So although we are locked in for a year (unless we manage to get out within the cooling off period), its not going to cost very much.

Setting up the Cable Modem was easy, since the house already has wiring for cable all I had to do was hook it up and call them. Its a shame it wasn’t that easy to set up the routing for our network, but that’s another story…

The other 8Mb ADSL service from Orange should be free, because the account is in Ben’s name now and as he pointed out, he should be getting it for free since he pays Orange enough money as it is for mobile phone service!

So I am happy now and maybe when the ADSL gets connected we can play around with load balancing!

Also, I got to play around with the Avatar creator on the Simpsons Movie website, and I made the likeness of me that you see here!

Learn Geography while you Shower

I’d like to show you my new Shower Curtain….



Yep, its a map of the world!

I think its great, Geography was one of my best subjects at school and as you probably know, I am no stranger to travelling!

Here is a close up of my corner of the world…



I think everyone should get one, so they can brush up on their world geography before they go to school or work!

Something weird I saw tonight!

Whilst walking around ‘The Barbican’ which is the oldest part of Plymouth, and the place where the Pilgrims left for a better life in the New World, I happened upon this….

Yes, believe it or not, that is a “Party Ambulance”. No it doesn’t go around the city picking up the people who have had a few too many drinks and ruined the party atmosphere – the itention is that you hire it out and drive around town with tunes and a lightshow in the back (I didn’t look inside, so I can’t be sure if there is a strecher or defribulator!).

This is the latest (or so it would seem) in the Limo type party experience. I remember last year someone was hiring out a fire truck to take you to your party, well now you can have the “Party Ambulance” pick you up when all that partying is done!

You saw it here first kids!