Last Updated: February 25, 2016
·
1.256K
· patrickocoffeyo

Fixing PHP in Ubuntu 13.10

If you are running Ubuntu, and you upgrade your server (or most likely your dev machine) to Ubuntu 13.10, you may run into the following error:

PHP message: PHP Fatal error:  Call to undefined function json_encode() in /my/file/index.php

It took me a minute to figure this out but evidently due to a licensing issue some >= PHP 5.5rc2 distros have removed the JSON extension. So you'll need to install a package yourself:

sudo apt-get install php5-json

Note that you may need to restart php, or php5-fpm if you are using nginx. :)