I am a web developer specialising in web driven applications using PHP, MySQL, Symfony and Zend and I am currently working for the The Drum in Glasgow, Scotland.

Most days I can be found frantically coding away with EuroDance in my ears and consuming what I hope to be a never ending supply of coffee... happy days!

ORM Designer - A visual editor for PHP Doctrine, Doctrine2, Propel and CakePHP

A week or so I got an unexpected email from Ludek Vodicka asking me to have a look at ORM Designer for creating and maintaining my database schemas for the Symfony projects I have been working on.  Up until now I have been using MySQL Workbench to create my ER-diagrams and maintain my database structure but I've come up against a few obstacles when trying to use it with projects using doctrine so I thought why now.

I fully expected ORM Designer to be a MySQL Workbench clone (and it's obviously been a question that has been raised before - ORM Designer and MySQL Workbench comparison) but I must admit I was pleasantly surprised to find out is was not.  To try and break myself into it easily I opted to start working on the database schema for the re-build of Manage My Alerts which I have intended to re-build using Symfony for quite a while.

Read more

VPN Issues with O2 Wireless Box II

For the last few months I have been connecting to the VPN at work via my O2 Wireless Box II quite happily until it suddently stopped working about 2 weeks ago which has caused me no end of headaches (tight deadlines looming etc). Each time I tried to connect I got presented with a "Error 619 - Disconnected"

I have had my laptop checked out by the IT guy and everything connected fine when it was in at the office and even my iPhone could connect to the VPN when using 3G but this Error 619 kept appearing each time I tried to connect to the work VPN via my O2 Wireless Box II using either the laptop or iPhone.

Read more

Sony VGN-FE21B Memory Stick fix for Windows XP

My Sony VGN-FE21B laptop has been having problems with performance over the last few months, applications were taking a long time to load and the hard drive was getting cluttered with obsolete files, so at the weekend I decided to re-install Windows XP Pro onto my Sony VGN-FE21B laptop.

The original operating system was Windows XP Home but since the laptop has been bought primarily for work purposes, I had also bought a copy of Windows XP Pro but each time I install Windows XP Pro on my Sony VGN-FE21B laptop it always has a missing icon for the memory stick in My Computer. I imagine this is because the hardware is specific to Sony and not a generic Windows XP driver.

Read more

mysqldump on Windows gives "Access is Denied"

I recently had to back up a MySQL database on a windows server so I could restore it to my local MySQL server for analysing the structure of an existing site which we are going to be rebuilding. I have done this hundreds of times on linux server but the usual command did not appear to work on this windows server. I was using:-

but when I ran this I was presented with an "Access Denied" message.

Read more

Wordpress wp_redirect() shows a blank page

Over the last few weeks I have been working on my first wordpress plugin and I am quickly getting to grips with how it all pieces together but I ran into a problem with a rather basic piece of functionality that pretty much rendered the plugin useless until I figured out the issue.

The section I was working on was a form submission (within the wordpress administation) which saved the form values into the database and then redirected the user upon success to another page (using wp_redirect) but this resulted in a blank content pane.

Read more

User Profile Service Failed the Logon

This Christmas was the quietest Christmas I have had in years in terms of the obligatory "if you have got the time" IT jobs as I only had 1 request for fixing a computer this year (instead of the 4 computers and a DVD player I had a few years back... all requested within 2 hours of arriving home).

Luckily this one turned out to be relatively simple and only took 5 minutes to fix although when I first heard about it I thought it was going to take a few hours. My aunt and uncle reported a problem with logging into their laptop (running Windows Vista Home Premium) on my uncle's profile where it would give an error message "The User Profile Service failed the logon", after which it would simply return them to the profile selection screen.

Read more

Raw SQL from Doctrine Query Object - Revised

A few months ago I posted an article taking about how to get the raw SQL from a Doctrine Query Object but with the release of Symfony 1.3 and Symfony 1.4 it would appear that the code no longer works.  As a result I've updated the code to work with Symfony 1.2 - 1.4 and you can find the updated source below:-

function get_raw_sql($query) {
    if(!($query instanceof Doctrine_Query)) {
        throw new sfException('Not an instanse of a Doctrine Query');
    if(is_callable(array($query, 'buildSqlQuery'))) {
        $queryString = $query->buildSqlQuery();
        $query_params = $query->getParams();
        $params = $query_params['where'];
    } else {
        $queryString = $query->getSql();
        $params = $query->getParams();
    $queryStringParts = split('\?', $queryString);
    $iQC = 0;
    $queryString = "";
    foreach($params as $param) {
        if(is_numeric($param)) {
            $queryString .= $queryStringParts[$iQC] . $param;
        } elseif(is_bool($param)) {
            $queryString .= $queryStringParts[$iQC] . $param*1;
        } else {
            $queryString .= $queryStringParts[$iQC] . '\'' . $param . '\'';
   for($iQC;$iQC < count($queryStringParts);$iQC++) {
       $queryString .= $queryStringParts[$iQC];
    echo $queryString;

I hope that it proves useful.

Read more

TRUNCATE TABLE with Symfony and Doctrine

I am often importing data into a symfony project from an existing site or a CSV file and re-writing this data into the fixtures.yml is usually too complicated or time consuming so I end up writing bespoke import actions.

While I am writing these actions I often find that I have to delete the contents of the MySQL tables as you can never write the routine complete and accurate in one go so as you build it up in smaller steps you find that you have to get rid of the previously old data.

Read more


Digital Ocean

Chris's Reading List

BFF @ SoundCloud

Our friends at SoundCloud embarked on a journey a few years ago that changed their system and moved it from a monolithic Rails application towards an ecosystem of microservices. Read more

The Drum

The Drum

Google'€™s AMP is bringing some much needed speed to mobile but the transition won'€™t be easy for publishers

A week after launching, the Google-led Accelerated Mobile Pages (AMP) initiative has raised more questions than answers for publishers... Read more



Quick Tip: How to Permanently Change SQL Mode in MySQL

MySQL 5.7 introduced some awkward changes for older codebases and tends to break apps. Here's how to temporarily (or permanently) lower the strictness level Read more



How to Build Your Own Dependency Injection Container

Andrew Carter builds a Dependency Injection container from scratch, showing you how that rocket science is really just fireworks strapped to lego figures! Read more



13 Reasons Your Organic Traffic is in Decline | It's Not a Penalty

The landscape of search engine optimization has changed drastically in the last 3-4 years. Even as it changes, a lot stays the same. It has been very challenging to see a multitude of friends and colleagues approach me with problems that often seem beyond repair with clients that they have worked with for years. Read more



WordPress Sites Now Support Google’s AMP To Make Mobile Pages Load Much Faster

Google has some big plans when it comes to making the web faster on your mobile phone. The company just added AMP-enabled pages in its mobile search results... Read more