Yearly Archives: 2011

2011 wrap up

As I have done in 2008, 2009 and last year, I thought I'd continue my tradition of recapping my year.


PHPBNL 2011 happened in January. Also, my Mac OS X application, Daily Jotter was released onto the Mac App Store.

My app is on the Mac App Store!


The first PHPucEU happened in Manchester which was great fun and, of course, the PHPUK conference in London. The biggest news for us though, was that we moved house in February!

We have keys to the new house!


I went to Canada for the rather excellent Confoo conference and watched a snowball fight!

Snowball fight!


A relaxed month after 3 months of conferences and a house move. There was a Royal wedding in the UK which resulted in a lot of merchandising!



May was the busiest month ever. Both sons have their birthdays in May and DPC in Amsterdam and php|tek in Chicago are back to back conferences! So many good photographs this month, but I have gone with this one of Jeremy Kendall as he took many excellent photographs at tek!

Here's looking at you!


Our trip to the zoo this year was in June when we went to Twycross Zoo.



We went to the beach in July.

On the beach


In August we went to the Fleet Air Arm Museum.

Fleet Air Arm Museum


My eldest son achieved his Grade 1 classical guitar certification this month. We also went to a friend's wedding.



October saw the very excellent PHPNW conference return for its forth year and I was very glad to be asked to do a ZF2 tutorial which seemed to go well.

Rick and Jeremy


November was the month that John Arnold held his creativityex project. I particularly liked my effort for negative space:



Last month of the year and as part of the Worcester Flickr group, I got to take a photograph in a studio!


All in all, a pretty good year. One interesting thing I did notice was that I have a lot more good photos sitting in Aperture than I published. I think this is because Aperture is so slow to use on my old Macbook Pro. I was better at publishing photos with Capture NX2 and I thought that was slow; Clearly it wasn't that bad!

Bring a laptop to my ZF2 tutorial at PHPNW11

If you are attending my ZF2 tutorial at the PHPNW11 conference on Friday, I thought I'd remind you that you may find it useful to bring a laptop.

Ideally, your laptop should be set up with PHP 5.3 and MySQL and a working copy of my ZF1 tutorial. It would be a good idea to have a vhost set up on http://zf2tutorial.localhost or similar. Ability to create additional vhosts may come in handy. The PHP cli tool should also work as you'll need to run some php scripts from the command line.

I'm going to be covering ZF2's autoloader, dependency injector, event manager and then we'll go through the current Mvc prototype. We'll also be doing some exercises if we have time.

I'm looking forward to it and hope you are too!

Day Camp 4 Developers #3: Project Management

I'm delighted to be able to announce that I'm speaking at the next Day Camp 4 Developers on 1st October.

Day Camp 4 Developers is a one-day online conference run by our friend Cal Evans and is now onto its 3rd outing. An online conference is one that you attend in your own home (or office!) which keeps the costs down considerably, so you have no excuse not to buy a ticket: just $40!

Day Camp 4 Developers is unusual in that it it concentrates on the "soft" skills that a developer needs in order to do their job well. The topic for this Day Camp is Project Management which is something that every developer should have knowledge about. Even if you aren't a project manager yourself, understanding what it is and why it helps is vital for your career development in any team based undertaking.

I'm talking on how we manage projects in my company. The idea is to give you an idea of the things that have to be done in order to take a proposal through to a live website as there's more to it than just writing the code. I've found that now that all of our team here understand the project management side of the job, the whole process goes much more smoothly and more profitably for everyone. Hopefully I'll be able to help you understand what your project managers are doing during their day too!

Setting up PHP & MySQL on OS X 10.7 Lion

With OS X 10.7, Apple continues to ship PHP 5.3 with PEAR, GD and PDO_MYSQL out of the box. This is how to set it up from a clean install of 10.7.


Ensure that the following directories exist:

sudo mkdir /usr/local/include
sudo mkdir /usr/local/bin
sudo mkdir /usr/local/lib
sudo mkdir -p /usr/local/man/man1


  1. Download the 64bit DMG version of MySQL 5.1.x (or 5.5.x) for OS X 10.6 from and install the pkg, the startup item and the pref pane.
  2. Add /usr/local/mysql/bin to the path: vim ~/.bash_profile and add:
    export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH
    export EDITOR=vim

    at top of file. (Note that we set EDITOR whilst we are here so that svn is happy!)

  3. Set up MySQL root password:
    mysqladmin -u root password {new-password}
    mysqladmin -u root -p{new-password} -h localhost password {new-password}
    mysqladmin -u root -p{new-password} reload

    Clear the history file by typing history -c so that {new-password} isn't in plain text on the disk.

  4. Now ensure that the mysql.sock file can be found by PHP:
    1. Ensure that MySQL is running
    2. sudo mkdir /var/mysql
    3. sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock


  1. cd /etc/apache2
  2. Give write permission the config file to root: sudo chmod u+w httpd.conf
  3. sudo vim httpd.conf
  4. Find #LoadModule php5_module libexec/apache2/ and remove the leading #
  5. Find AllowOverride None within the <Directory "/Library/WebServer/Documents">section and change toAllowOverride All so that .htaccess files will work.
  6. Change permissions back: sudo chmod u-w httpd.conf
  7. Restart Apache by unticking and then ticking again the Web Sharing checkbox in System Preferences -> Sharing
  8. Open Finder and navigate to /Library/WebServer/Documents/ using shift+cmd+g
  9. Create a new folder called "orig" and place all files currently in the Documents folder into it. (note that it will ask for your password as the Documents folder is only writable by root.
  10. Create a new file called info.php with <?php phpinfo(); inside it.
  11. Use Safari to navigate to http://localhost/info.php and check that the PHP version is displayed (5.3.6 at the time of writing).


  1. cd /etc
  2. sudo cp php.ini.default php.ini
  3. sudo chmod ug+w php.ini
  4. sudo chgrp admin php.ini
  5. vim php.ini (assuming your user is a member of the admin group) and change settings appropriately. Change:
    error_reporting  =  E_ALL | E_STRICT
    display_errors = On
    html_errors = On
    extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20090626"

    (I like to see my xdebug errors in bright orange!)
    Also, change all instances of /var/mysql/mysql.sock to /tmp/mysql.sock


Can't have a PHP development environment without xdebug! Apple appears to agree as Lion ships with it.

  1. vim /etc/php.ini
  2. Find the line:
    and remove the semicolon at the start
  3. If you want to configure your xdebug settings, then scroll to the end of the file and look for the [xdebug] section. I like these settings:
    xdebug.var_display_max_children = 999
    xdebug.var_display_max_data = 99999
    xdebug.var_display_max_depth = 100

    (use with caution…)

  4. Restart apache: sudo apachectl restart and check in the phpinfo that xdebug is now loaded.


We need PEAR! For some reason, it's not set up ready to on Lion, but the install phar file is here, so we just need to run it.

  1. cd /usr/lib/php
  2. sudo php install-pear-nozlib.phar
  3. Edit/etc/php.ini and find the line: ;include_path = ".:/php/includes" and change it to:
    include_path = ".:/usr/lib/php/pear"
  4. sudo pear channel-update
  5. sudo pecl channel-update
  6. sudo pear upgrade-all

PHPUnit and friends

I assume that everyone needs these…

  1. sudo pear channel-discover
  2. sudo pear channel-discover
  3. sudo pear channel-discover
  4. sudo pear install phpunit/PHPUnit
  5. sudo pear install phpunit/phpcpd
  6. sudo pear install PHP_CodeSniffer


A couple of projects I work on use the PECL OAuth component:

  1. Ensure you have installed Xcode from the Mac App Store
  2. Download the latest PCRE source code from and unzip to a folder on your desktop
  3. cd ~/Desktop/pcre-8.12
  4. ./configure
  5. sudo cp pcre.h /usr/include/
  6. Remove the pcre folder on your desktop as you don't need it any more
  7. sudo pecl install oauth
  8. Edit/etc/php.ini add these lines to the end of the file:
  9. Restart apache: sudo apachectl restart and check in the phpinfo that OAuth is now loaded.


This is useful! Follow the installation details by Michale Gracie here:

It all works on this machine, anyway :)

Other options

If you'd rather use a packaged version, then these are two alternatives:

Zend_Config_Ini and a string

One thing that is different between Zend_Config_Xml and Zend_Config_Ini is that with Zend_Config_Xml you can pass in an XML string as the first parameter of the constructor and it will work. This doesn't work with Zend_Config_Ini as we use parse_ini_file() under the hood.

With PHP 5.3 however there is is a new function called parse_ini_string() which will allow us to load arbitrary ini string into Zend_Config objects. This can't go into Zend Framework 1 though due to our PHP 5.2.4 minimum version requirement.

As I needed this for a project, I extended Zend_Config_Ini to support this feature, which means simply overloading a single method

class App_Config_Ini extends Zend_Config_Ini
* Load the INI file from disk using parse_ini_file(). Use a private error
* handler to convert any loading errors into a Zend_Config_Exception
* @param string $filename
* @throws Zend_Config_Exception
* @return array
protected function _parseIniFile($filename)
set_error_handler(array($this, '_loadFileErrorHandler'));
if (substr($filename, -4) == '.ini') {
$iniArray = parse_ini_file($filename, true);
} else {
$iniArray = parse_ini_string($filename, true);

// Check if there was a error while loading file
if ($this->_loadFileErrorStr !== null) {
* @see Zend_Config_Exception
require_once 'Zend/Config/Exception.php';
throw new Zend_Config_Exception($this->_loadFileErrorStr);

return $iniArray;

The actual change is to see if the last 4 characters of the filename are ".ini" and if they aren't then use parse_ini_string() instead of parse_ini_file(). The rest of the code is just error handling.

This is one area where I really like it when a class implements methods that done just one thing.

tek11 photos

Following on from the previous post, these are some of my favourites from php|tek 11.

On the day before tek started, playing mini-golf with Helgi, Ian, Kathy, Rafael & Lorna was fun

Professional at work...

It wouldn't be a trip to Chicago without pizza!


I loved Liz's hat

Liz and her hat

Lig had a two-hands-one-mouth problem…

Red or White?!

The social events at tek are great. You can usually find Liz enjoying the party!

Centre of attention

It was always fun to see groups showing off some cool tech or another to each other. In this case, I think Lorna and Matthew were discussing using LaTeX for presentations

Matthew and Lorna

Jeremy took great pictures too and also posed on the couch

Here's looking at you!

I think the funniest moment of tek11 was when Ian read us excerpts from Page & Didday's Fortran 77 for Humans he found on the shelf at Potbelly's. Lunch will never be the same again.

Ian reads us exercepts from the Fortran book

Looking at this set of photos, you'd think that all we did was party. In fact, I also went to a number of amazing sessions where I learnt stuff, but I was so busy paying attention, I didn't take any photos during those times. I had a great time at both DPC and php|tek this year and if you haven't been to a PHP conference, then I recommend that you go to the next one you can!

The full set of photos is up on Flickr.

DPC 11 photos

A few weeks ago, I managed to visit two conferences back to back: DPC and php|tek. I managed to take some photos and these are some of my favourites from DPC.

I finally managed to snag a good picture of Juozas!

Juozas Kaziukenas

Harrie was an excellent DPC host.


Aral gave an excellent keynote and was around for the conference. He had us in stitches when trying to tweet from an Android phone!

Aral Balkan

On the hallway track, David wasn't shy about sharing his opinions on web services!

David and Lorna discussing Restful APIs

It was great catching up with Lig, who wore the best t-shirts!

Lig *is* the IT guy!

Finally, the best photos I took at DPC were both of Cal:

Cal, relaxing


The full set of photos is up on Flickr.

ZF2 Training at PHPNW 2011!

The fabulous PHPNW conference is back again this year on October 8th and 9th and tickets are now for sale for a mere £72. Buy now! as you only have a few days left at that price. There's no need to wait for the schedule as we know from the past 3 years, that it's going to be a great selection of relevant topics.

More importantly, this year there's a tutorial day on Friday 7th October which is also very cost-effective at £330 for the tutorial day and the conference.

There's a great set of tutorials:

  • Rob Allen on Zend Framework 2 (that's me!)
  • Marcus Deglos on Drupal performance and tools
  • Arne Blankerts on Security
  • Lorna Mitchell on Web services
  • Stuart Herbert on Maintainable applications in PHP using components

Obviously, I'm slightly biased, but I think that the Zend Framework 2 tutorial day will be great! ZF2 is so new, I'm not sure exactly what we'll be covering. My plan at the moment is to cover a few key topics in depth, so that you really understand them and be confident that you can develop new ZF2 applications going forward.

Head on over to the tutorial day page and buy a ticket now :)

If you're planning on attending the tutorial, I'm interested in what you'd like to see covered; let me know.