xjx424
xjx424

Reputation: 183

JSON not compiled in php

I installed PHP Version 5.5.1-2 on Ubuntu 12.04 and JSON was not bundled with it (as far as I can tell).

I've read that I will have to reinstall php using the --enable-json or --with-json option.
So my questions are:

How can I verify JSON is not installed?

If not, do I reinstall php like this: apt-get install php --with-json (do I include --enable-json)?

Will my current settings be lost if I reinstall php?

Thanks

Upvotes: 4

Views: 9466

Answers (4)

Festus Tamakloe
Festus Tamakloe

Reputation: 11310

Ubuntu 12.04 doesn't support

sudo apt-get install php5-json

directly. the installer change it automatically to

sudo apt-get install php5-common

My recommandation should be to use sudo apt-get install php5-common instead of sudo apt-get install php5-json because sudo apt-get install php5-common will install also automatically all other dependencies for you

Upvotes: 0

James Dunmore
James Dunmore

Reputation: 1310

If you haven't already installed it:

sudo apt-get install php5-json

(more info: http://iteration99.com/2013/php-json-removed-from-php-5-5/ )

Shouldn't overwrite any other settings.

Upvotes: 17

Anigel
Anigel

Reputation: 3437

JSON is enabled by default on ubuntu

#php -i | grep -i json
json
json support => enabled
json version => 1.2.1

Upvotes: 2

Halcyon
Halcyon

Reputation: 57703

Test if json_encode (or any of the other JSON functions) exist.

Either call it and observe an error or use function_exists("json_encode").

Upvotes: 1

Related Questions