Composer installing: the json extension is missing

前端 未结 5 1065
梦毁少年i
梦毁少年i 2021-01-18 03:43

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

 #!/usr/bin/env php
Some settings on your machine make Com         


        
相关标签:
5条回答
  • 2021-01-18 04:27

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

    php -m
    

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

    The fix for this was for me to perform:

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

    which grants read and execute permissions for that folder and it's contents to everyone.

    0 讨论(0)
  • 2021-01-18 04:34

    Bug php not load extension install

    create file php.ini

    # /etc/php/7.2/cli/conf.d/php.ini
    extension=json.so
    extension=phar.so
    extension=iconv.so
    
    0 讨论(0)
  • 2021-01-18 04:45

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

    php --ini
    

    You should see a line like

    Loaded Configuration File: /path/to/php.ini

    Open that file and look for extension=json.so. If it's there, uncomment it. If not, add it in. Now you should see json listed when you do php -m and composer should work.

    0 讨论(0)
  • 2021-01-18 04:47

    On Centos 8 with PHP 7.2, after comprehensive research, I have concluded that the only solid way to fix it is reinstalling PHP with its newest version. (7.4 was the latest version for me) Here you can find others who share the same conclusion; laracasts

    0 讨论(0)
  • 2021-01-18 04:47

    I encountered the same error, but the difference was that when I ran php -m the json module was not listed, so I just installed json PHP module using the command below:

    sudo yum install php-json
    

    the error was fixed and I was able to install composer. I was using CentOS 8 stream, PHP7.2.

    0 讨论(0)
提交回复
热议问题