JSON not compiled in php

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

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

How to check that JSON is not installed?

If not, reinstall php as follows: apt-get install php --with-json (do I enable --enable-json)?

Will my current settings be lost if I reinstall php?

thanks

+4
source share
4 answers

If you have not installed it yet:

sudo apt-get install php5-json

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

Do not overwrite other settings.

+17
source

JSON is enabled by default on ubuntu

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

Check if json_encode (or any other JSON function) exists.

Either call it and watch for the error, or use function_exists("json_encode") .

+1
source

Ubuntu 12.04 does not support

 sudo apt-get install php5-json 

directly. the installer will automatically change it to

 sudo apt-get install php5-common 

My recommendation 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 automatically install all other dependencies for you

0
source

Source: https://habr.com/ru/post/1499440/


All Articles