我试图安装Facebook PHP SDK与作曲家。这就是我得到的结果

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

    Problem 1
        - Installation request for facebook/php-sdk dev-master -> satisfiable by facebook/php-sdk[dev-master].
        - facebook/php-sdk dev-master requires ext-curl * -> the requested PHP extension curl is missing from your system.

问题是,我有卷曲扩展启用(未注释在php.ini)。当我运行phpinfo()时,它说它已启用。 我唯一的线索是,当我运行$ php -m, '卷曲'行是缺失的,但我不知道该怎么做。

我在Win8上有wamp 2.4,我在cmd.exe中运行作曲家。


当前回答

尝试使用下面的代码片段安装php5-curl。

sudo apt-get install php5-curl

如果它不能工作,尝试下面的代码,我相信它会工作得很好。

sudo apt-get install php-curl

对我来说很有效……祝一切顺利:)

其他回答

这个对我很有用:http://ubuntuforums.org/showthread.php?t=1519176

使用curl -sS https://getcomposer.org/installer | php命令安装composer后,只需运行sudo apt-get update,然后使用sudo apt-get install php5-curl重新安装curl。然后,composer的安装过程应该可以工作,这样您就可以最终运行php composer了。Phar install以获得在您的编写器中列出的依赖项。json文件。

尝试使用下面的代码片段安装php5-curl。

sudo apt-get install php5-curl

如果它不能工作,尝试下面的代码,我相信它会工作得很好。

sudo apt-get install php-curl

对我来说很有效……祝一切顺利:)

在我的例子中,我从PHP5移动到PHP7,我得到了这个错误, 只需转到/bin/php/php7/php.ini,然后取消注释extension=php_curl.dll,重新启动服务器,重新运行composer安装。

如果使用wamp去:

wamp \ bin \ php \ php.5.x.x \ php . ini 发现: ;扩展= php_curl.dll 删除(,)

不知道为什么一个Linux命令的答案会得到这么多与Windows相关的问题的投票,但无论如何…

如果phpinfo()显示Curl已启用,而php -m没有,这意味着你可能也有一个php-cli.ini。运行PHP -i并查看加载了哪个ini文件。如果是不同的,区分它并在CLI ini文件中反映和差异。那你应该可以出发了。

顺便说一下,下载并使用Git Bash代替cmd.exe!