Last Updated: February 25, 2016
·
1.485K
· 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. :)

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#php
#ubuntu
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside