Installing and configuring Mcrypt and JSON for PHP 5.5 in Ubuntu
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:
sudo apt-get install php5-json php5-mcrypt
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:
; configuration for php json module ; priority=20 extension=json.so
Now enable the mods and restart the server:
sudo php5enmod json sudo php5enmod mcrypt sudo service apache2 restart
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.
sudo apt-get install php5then 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.