WordPress 2.8 automatic upgrade fails

I’ve been trying to update my wordpress blogs from various versions like 2.5 and 2.7 to the newest 2.8 for a while now, but was never able to do it automatically.

Every time I pressed the “upgrade automatically” button, it told me it was downloading the latest file from WordPress, but it never got any further than that. I logged in to my site using my FTP client and found a 0KB sized file called wordpress2.8.zip in the wp_content folder, so I thought I’d found the issue – maybe the script can’t actually download the file and save it to disk because of permissions. I chmodded the file and then the folder to allow write access, but no joy.

Of course, I could have just downloaded the latest install from wordpress and done a manual upgrade, but there’s about 8 million files in the zip file and I didn’t want to have to upload that to 5 different sites! πŸ˜‰

After a bit of research, it turns out that the problem is that the auto-upgrade script requires PHP5 to run, and as my sites are hosted on 1and1 servers which default to php4, the script was failing!

So if you’re having the same issue, all you need to do is make sure your wordpress is running on PHP5 instead of 4! If you’re on a shared server and you can’t change the server’s config, you can still tell apache to run your scripts as PHP5 rather than 4 by adding the following line to your .htaccess:

AddType x-mapp-php5 .php

All that does is tells apache to to parse all .php files with the PHP5 parser rather than whatever the server’s default is! So just throw that in the .htaccess you find in the root of your site – put it just after the “# END WordPress” line – save it, upload it and try doing the upgrade again – it worked first time for me! πŸ™‚

If you’re still having trouble after that, or you’ve got a different solution, please post a comment here and let others know!

5  

The JavaScript Programming Language

Someone posted these links in a resources thread in one of the programming forums I contribute to.

It’s basically a presentation by Yahoo! JavaScript Architect Douglas Crockford – it’s a couple of years old, but it’s all still pretty much accurate.

It’s a must-see for anyone who doesn’t know much about JavaScript, or more importantly, anyone who thinks they know about it and has cast it aside as a “simple scripting language”. πŸ˜‰

It’s about 2 hours long so it’s a bit of an investment, but it’s been broken up into 4 half-hour-ish videos for your viewing pleasure.

Enjoy:

Part 1, Part 2, Part 3 and Part 4

2  

Apple iPhone OS 3.0 – function follows form

I was reading a post over at ALA today called In Defense of Eye Candy, in which Stephen Anderson talks about how actually putting some effort into the way a site looks can have positive effects on the way the site is used.

The more we learn about people, and how our brains process information, the more we learn the truth of that phrase: form and function aren’t separate items. If we believe that style somehow exists independent of functionality, that we can treat aesthetics and function as two separate pieces, then we ignore the evidence that beauty is much more than decoration. Our brains can’t help but agree.

Just 5 minutes after I read the article I opened up Safari to test one of our sites in, and saw a great big shiny blue button advertising the upcoming iPhone OS 3.0 software on the apple startpage.

Ok, yes, the graphics are quite cool, but what drew my attention was the list of new features Apple will be adding to the iPhone/iPod Touch, including:

* Search your iPhone
* Cut, copy, and paste
* Send photos, contacts, audio files, and location via MMS*
* Read and compose email and text messages in landscape

Apparently, “For iPhone owners, it just keeps getting better” – that’s right – it’s getting so much better that after a year and a half, iPhone users will finally be able to do things other phones/PDAs have been already been doing for years! πŸ˜€

kthnxbai_thumb

I’m thinking someone at Apple should read Anderson’s articles and get them to spend a little less time faffing around with flashy graphics, and a little more time on functionality…

Come on Apple, sort it aaaaht.

1  

Album artwork doesn’t show on iPod Touch Cover Flow

If you find that your iPhone/iPod Touch isn’t displaying the album artwork in coverflow, but your computer that you sync it to shows it fine in iTunes, you’re probably wondering what’s going on!

This happened to me a few days ago, so I did some searching – most people seem to think it’s only just started happening in the latest versions of iTunes and on iPhones/iPod Touches with the 2.2 firmware on – I didn’t notice it happening before I upgraded my firmware, but then I only noticed it happening now by chance, so I can’t really say if what these people are saying is true.

Anyway, it’s a solution you came here for, so here goes.

I tried resetting my iPod, incase it was just something dodgy going on on the file system, or another process interfering. No Joy. πŸ™

I’ve tried clearing all my album artwork in iTunes and then finding the images again using a combination of the “Get Album Artwork” feature in the iTunes store and some Amazon.co.uk searches, then syncing the device again. Again, no joy.

Finally, I decided to just delete the offending albums from my iPod and upload them to it again. To do that without losing the albums from your iTunes library, just plug your iPhone/iPod in, start iTunes, click on the device name in the list on the left and tick the box that says “Manually manage music and videos”. That will allow you to browse the library on your device, select the albums in question and delete them. When you’ve done that, untick the box you just ticked, hit OK in whatever dialogue box iTunes pops up and let it sync your device again.

This should copy the songs/albums from your computer’s library back to the device, and hopefully send the album artwork along with them!

Well, that’s what worked for me – if anyone has any better method of restoring artwork on an iPhone/iPod Touch, please leave a comment and let me know what you did!

11  

Mod rewrite URL with 2 question marks?

A colleague asked me for some help with a few RewriteRules in his .htaccess today. One of the links he was trying to rewrite was unusual in the fact that is had 2 question marks “?” in it.

Let’s say the url looked like:

www.site.com/2009/1/is-this-a-legit-url?-i-don't-know?

and you wanted to rewrite that to:

www.site.com/2009/1/is-this-a-legit-url-i-dont-know/

You might think the rewrite would be simple, like so:

RewriteRule ^2009/1/is-this-a-legit-url\?-don%27t-know\?/?$ /2009/1/is-this-a-legit-url-i-dont-know/? [R=301,NC,L]

If you run that though, apache will throw a wobbly and tell you that “The requested URL /2009/1/is-this-a-legit-url was not found on this server.”

The reason for this is the server thinks everything after the first “?” is the querystring, so in this case, the apache is looking for a file/folder called “/2009/1/is-this-a-legit-url” and it will pass the querystring through as “-i-don’t-know?”

Of course, the simple solution would be to just match up to the first question mark in the rule, but that might not always be appropriate – e.g. if the string began with a question mark for whatever reason!

We came up with a cunning workaround for this by matching both the request url and the querystring like so:

RewriteCond %{QUERY_STRING} ^-i-don%27t-know\?/?$ [NC]
RewriteRule ^2009/1/is-this-a-legit-url$ /2009/1/is-this-a-legit-url-i-dont-know/? [R=301,NC,L]

Now, if a request like the original one above comes in, the query string will match the rewrite condition, and the requested URL will match the rewrite rule! πŸ™‚

Note the extra question mark at the end of the rewritten rule “/is-this-a-legit-url-i-dont-know/? [R=301,NC,L]” – you need that in there to stop the server trying to push the original query string through.

Without it, your URL will be redirected to:

www.site.com/2009/1/is-this-a-legit-url-i-dont-know/?-i-don%2527t-know%3f

Unfortunately, using this method does mean that if you have any variable in the query string that you want to push through, you won’t be able to… Chances are though, that if you have 2 question marks, something’s gone wrong anyway, so this fix is better than nothing! πŸ˜‰

0