I knew the old car’s engine needed work, but I kept putting it off.

Yes, there was advanced word that Reclaim Hosting would be making PHP 7.x the default for all sites, and that support for older versions of PHP would go away. I knew this was an issue for one of mine, the Five Card Flickr Stories site originally built in maybe 2008. This was a built by hand PHP/MySQL site (yup I designed my own database) and I think the connection scripts were ones I used way back in my days at Maricopa in the early 2000s.

In fact, the only way it had been working was the MultiPHP cpanel tool Reclaim provides that let me designate the old site should use PHP 5.4, otherwise the old site just sat dead in a field.

But I put off the overhaul.

I can tell you that this change happened yesterday, sandwiched in time between 2 tweets.

In the morning, for reasons I lose now, I felt like making a case for the value of flickr. I read people like Dean Shareski are canceling accounts to move their stuff to Google, when to me, the value of flickr is beyond personal storage of photos and that it’s API (which it has never broken, casting side eye at Twitter, Google, Instagram that break their own APIs on a regular basis) allowed me to create interesting sites that leverage shared photos from many people.

Because it’s how I do things, I made sure the site I was talking about works, so I had gone in before tweeting and generated another story created from 5 random flickr photos.

That’s all nice. Moving on to the rest of the day.

Until later. Four hours later.

I had a bad feeling, and when I hit my site, I saw the HTTP error and a dead site. Thus, I was sure the PHP change happened (confirmed in the error logs as the old functions I was calling are no longer available).

Fortunately, I had not totally slacked off the task, at some time I had bookmarked a post that I saw provided an overview to change my old, now broken function calls –in php these are all ones like mysql_blah_blah — to the more up to date ones.

How to Convert MySQL to MySQLi PHP Code to Upgrade to PHP7 Doing the PHP MySQL MySQLi Migration

For the most part, it was just changing the names of the functions from ones like mysql_blah_blah()to mysqli_blah_blah($link). In the old code the reference to the database was assumed to be the one most recently used, now you have to pass the reference directly.

Luckily, when I did this stuff, I had put all of the database/PHP code in a single code library, so I just had to walk through and make updates according to the post above. The biggest change was changing the maybe 18 year old way I did connection scripts (learned this from Colen, a student programmer I hired at Maricopa) from something like:

/* ----------- DB_CONNECT -----------------------------------
Called to connect to mySQL database
-------------- DB_CONNECT ----------------------------------- */

function db_connect($db) {
	$ln = @mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS);
	if ( $ln && mysql_select_db($db,$ln) ) {
		return ($ln);
	} else {
		return false;
	}
}

to this:

function db_connect( $database ) {
	$ln = mysqli_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS, $database);
	/* check connection */
	if (mysqli_connect_errno()) {
		printf("Connection failed: %s\n", mysqli_connect_error());
		return false;
	} else {
		return ($ln);
	}
}

The only other change was updating the old version of the phpFlickr library to a newer one — where newer means 7 years ago. This is used to pass API calls to flickr.

It did not take too long (most of that was the usual stuff of typos and missing semi-colons) and Five Card Flickr Stories is back in action! I even tossed in an htaccess rule to redirect all traffic to SSL urls

The Five Card Story site is running again!

Yes, the web design is dated, and hard to use on a mobile, but look at the use- sitting there on its own, it has been used by people I never know are there to create 26397 stories from 10596 flickr photos tagged with “5cardflickr” (80% of them from Tom Woodward!)

It stuns me that it gets used almost every day, since fixing last night, there are at least 7 new ones added.

The whole story of this site is spun out in past blog posts, and I can find the first record of it in September 2008, when I got the idea to build it for a talk at the Learning 2.008 conference. Fitting with the concept that Everything is a Remix, I credit the origin to a talk by Ruben Puentadora showing us a web version of Five Card Nancy itself remixed from an analog card game crafted by Scott McCloud.

I got the idea I could use the same game mechanics, but figure out a way to use random images from a tag in flickr. The original prototype was hosted on an NMC web site now kaput, but I moved it to my domain maybe 10 years ago. You can still find the first story published there at https://5card.cogdogblog.com/show.php?id=7

There ya go, a 1 years old web hot rod, roaring down the road. Give it a spin yourself and add to the pool (if you have not bailed on flickr) by tagging photos with 5cardflickr (I forget to do this myself).

It’s rewarding both from a technical standpoint that the duct tape still holds the jalopy together, but moreso that teachers like Lisa and others still make use of it.

This is the kind of zoom zoom zoom I can handle now.


Featured Image:

Used Every Sunday By a Little Old Lady...
Used Every Sunday By a Little Old Lady… flickr photo by cogdogblog shared into the public domain using Creative Commons Public Domain Dedication (CC0)

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Profile Picture for Alan Levine aka CogDog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Leave a Reply

Your email address will not be published. Required fields are marked *