Composer installation: no json extension

I wrote in Linux Terminal: curl -s https://getcomposer.org/installer | php curl -s https://getcomposer.org/installer | php He said:

  #!/usr/bin/env php Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The json extension is missing. Install it or recompile php without --disable-json 

I did this: apt-get install php5-json So, I think it is installed. But it is strange when I write php -m This gives me a list without json:

 [PHP Modules] bcmath bz2 calendar Core ctype date dba dom ereg exif fileinfo filter ftp gettext hash iconv libxml mbstring mhash openssl pcntl pcre Phar posix Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib [Zend Modules] 

And when I write php5-fpm -m it sends this message:

 [PHP Modules] bcmath bz2 calendar cgi-fcgi Core ctype curl date dba dom ereg exif fileinfo filter ftp gettext hash iconv json libxml mbstring mcrypt mhash mysqli openssl pcre PDO pdo_mysql Phar posix Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib [Zend Modules] 

What am I doing wrong? I did not find a solution on GitHub and Google

+1
source share
2 answers

You probably need to enable the extension in your php.ini . To find out where this is for the PHP command line do

 php --ini 

You should see a line like

Uploaded configuration file: /path/to/php.ini

Open this file and find extension=json.so If he is there, uncomment him. If not, add it. You should now see the json specified during php -m , and the composer should work.

+4
source

In Ubuntu 14.04, for me, I found that the default permissions for the php.ini / etc / php5 / cli / file restrict the file only to the Root user, so if you run:

 php -m 

as non-root, you get far fewer modules than if you ran sudo php -m

The fix for this was for me:

 sudo chmod a+rx /etc/php5/cli/* -R 

which provides read and execute permissions for this folder and content for everyone.

0
source

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


All Articles