Ubuntu – what happened to json_encode in 13.10 php

13.10PHP

Just updated to saucy 13.10 and json_encode is missing from the bundled php. json doesn't appear in the phpinfo() output and i'm getting this error in my app:

PHP Fatal error:  Call to undefined function json_encode()

Anyone else experiencing this or know the fix?

Best Answer

Install php5-json:

sudo apt-get install php5-json

This used to be provided by php5-common but that has changed in Saucy. No idea why and seems like a silly thing to do but it's very simple to fix.

After the installation, make sure to also restart the Apache2 server:

sudo service apache2 restart