Ok now I have updated my system to Ubuntu 14.04 from 12.04 there has been a few changes, also if installing from scratch then a couple gotchas will hit you namely to do with PHP 5.5. In their wisdom the json extension has been removed from the PHP 5.5 so to fix this we will have to install it. So as we are talking about Mcrypt as well lets do this all at once.

First make sure you have installed the extensions:

Next in the json ini file there is a line we have to comment out so in /etc/php5/mods-available/json.ini we comment out the line with priority=20 so it should look like:

Now enable the mods and restart the server:

And that should be that and you have json and mcrypt working you can check with php -m and that will list all modules enabled.
For more info on php5enmod see Managing PHP 5.4 Extensions on Ubuntu.

Happy coding!

Since writting this article I installed a clean Ubuntu Server 14.04 and when adding php with sudo apt-get install php5 then php5-json will be installed automatically. This was a problem before Ubuntu 14.04 was release but no more. So if you are using Ubuntu 14.04 you can disregard info on json install.
  • jimmyd

    After installing Ubuntu Server 14.04 ALL mods are installsd
    automatically when installed. Saves a bunch of time on installation. Thanks guys

  • smor

    Thanks! after upgrading this helped me out.