Installing and configuring Mcrypt and JSON for PHP 5.5 in Ubuntu

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.

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.

21/04/2014 09:33:00 Shaun Freeman Filed Under: Linux Debian, PHP, Raspberry Pi, Server, Ubuntu

Twitter Feed
Shaun Freeman @Zendmaster

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/RnEYvUDFx2 The Josephus Problem - Numberphile

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/TEGV4DhLGI Blown Like the Wind

Shaun Freeman @Zendmaster

I liked a @YouTube video https://t.co/lSFWmpHTX1 Patrick Stewart talks about meeting Sting on the set of DUNE (Funny to the EXTREME)

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/pmXSmod4ti Anonymous - This will Change Everything You Know... (2018-2019)

Shaun Freeman @Zendmaster

I added a video to a @YouTube playlist https://t.co/GkwTCvBfes Will Artificial Intelligence Take Over The World?