Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

This afternoon’s glorious freelance waste of time was debugging a server’s PHP installation which got broken with a experimental installation of iRedMail — do NOT install iRedMail on a production machine, it’s meant for fresh installs only.

iRedMail’s removal script is great… if you want to remove apache, mysql, php, etc. etc. etc. Don’t do it.

That’s my scenario, you may have gotten this error in a different manner. Either way the solution is similar.

I rebooted my Ubuntu 12.04 Linode VPS (referral link) and found my Rails/Passenger sites came up first time, but my WordPress/mysql reliant php sites failed giving this error, or a variant thereof:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

You’ve probably already tried to reinstall your “php5″ “php5-mysql” packages already, but found it said they’re correctly installed.

Enter this line to find all packages that are in a “purged” state.

dpkg --get-selections | grep purge

Purged packages are uninstalled but not removed. Which is confusing, as you can’t install over them.

 apache2 purge
 libapache2-mod-php5 purge
 libaprutil1 purge
 php5-cli purge
 php5-common purge
 php5-imap purge

So you want to remove + reinstall the pertinent packages:

sudo apt-get remove php5-common

and then do the apt-get install command as per your original setup. So for me:

sudo apt-get install libapache2-mod-php5 php-pear php5 php5-cgi php5-cli php5-common php5-curl php5-gd php5-json php5-ldap php5-mcrypt php5-mysql php5-pgsql php5-readline

Then

sudo apachectl restart

Your mileage may vary.

CS Lewis, according to Alister McGrath (audio)

Lots of people quote CS Lewis, perhaps not knowing where he actually comes from or what he actually means. A Northern Irish boy, raised in East Belfast, he struggled through early faith journey eventually becoming an atheist before heading to Oxford. That’s not where the story ended. I saw the below quote tweeted in a positive life affirming sense (I imagine,) when in reality Lewis was overtly and unapologetically Christian in his writings after conversion.

“There are far better things ahead
than any we leave behind”

Alister McGrath (Oxford educated scientist, resident theologian, and author of far too many books) spoke today at a pair of events hosted by the QUB Chaplaincies at The Hub on Elmwood Avenue. Below are two recordings provided by The Hub team of the talks.

The former might be described as building the framework behind why we believe, touching on a little of how Lewis was a “travelling companion” to McGrath in his journey into faith; the latter is a broad overview of Lewis, his influences (including how the Northern Irish landscape influenced Narnia) and legacy of thought.

“Why I am a Christian, by a lapsed atheist…”

“CS Lewis’s Vision of Christianity and its relevance today”


For what it’s worth, McGrath’s biography
is available on Amazon.
C. S. Lewis: A Life: Eccentric
Genius, Reluctant Prophet

(affiliate link, current earnings in four years £0.00)

Adding links to PDFs using PHP ezPDF

I’ve been making some changes to a site which already uses the ezPDF class for creating PDFs from PHP. How to insert a link?

Helper methods seem to exist but they are not documented in the code and are a bit confusing to read. Instead, you can just embed a hyperlink into any (I think) text entry and it’ll be converted into a clickable link. Use the syntax below.

A very simple example of a complete PDF generation is shown here:

Note: you can get the complete “R&OS” ezPDF class here

Creating a download click tracker in Rails 4 – Also, Run-ins with Turbolinks

A Friday lunchtime double feature for you.

The task: create a click tracker, to keep a rough (accuracy isn’t of core importance, but why skimp?) measure of the number of time s a link has been clicked by site users.

Here’s some sample code I used for the new version of GiantsLive which contains a digital downloads feature.

The task is a fairly simple one, it doesn’t even require a controller, but here we use a migration to create a stats table, and a model to provide a simple API.

The ‘object_key’ I’ve used refers to an AmazonS3 object’s unique name (within a bucket), this is because each ‘fixture’ has several video files available to download.

Migration

Model

Usage

You could create a helper method to present the detail neatly, but that’s up to you. Hope that code is helpful, if you have any suggestions on how to clean it up any further do use the comments below.

Part 2: Turbolinks causing 403 problems

Or maybe just one. Rails 4.0 introduces a new feature called https://github.com/rails/turbolinks/ which is intended to reduce the amount of server requests caused by a page change, in very simple terms it means that instead of looking for CSS, JS and font files every time you click a link, it just asks for the HTML + images. I was getting a strange quirk in my tracking code whereby every click was creating two increment actions. I finally figured out the problem by looking my logs. An excerpt here:

You’ll notice the “Complete 403 Forbidden” first, then “Completed 302 Found” second. Turbolinks appears to have been requesting the file, failing and then resorting to a page reload. This caused the tracker to be triggered twice, and the statistics to be incorrect.

There is an open ticket on github regarding this issue. [h/t @StuartGibson]

A fix

As per the Turbolinks documentation, adding the html data attribute data-no-turbolink on a parent tag will disable any turbolink action from occuring. So, in my case:

<ul data-no-turbolink="">...

Problem solved.

New Music From Gungor: “Wayward & Torn”

The new album ‘I am Mountain’ is on its way, American Songwriter have a preview of a track. Sounding like a background hum from the set of Justified, it has a moody southern blues feel. While the track is supposedly set apart from the rest of the album, it paves a welcome path.

Listen to the track now

If you haven’t heard of [one of my favourite bands] Gungor… A little context, in the form of a video:

Updated
——-
iTunes pre-order & preview available here.

Sorry, I didn’t quite catch that? — Sally the sign language interpreter

A while ago I launched a new website for my friend Sally, who’s both a PhD candidate at Queen’s and a successful professional sign language interpreter for hire.

Check out the website at
http://signlanguageni.com

The simple site has two aspects: professional and academic. It’s somewhat adaptive (but perhaps not quite ‘responsive’?), has been developed to accommodate video content on each page if a video BSL interpretation is available and in future will allow Sally to receive feedback on various research projects.

Sally is a BSL/English interpreter and a first year PhD translation student. Through her research, she is exploring the demographics of the deaf signing population in Northern Ireland and the resources and opportunities available to this linguistic minority.

She adopts a balanced approach to practice and research, and is currently organising an academic conference on Sign Language and the Politics of Recognition in addition to her studies and interpreting work.

Freelance professional sign language interpretation services in Belfast, across Ireland and the UK.