我试图安装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中运行作曲家。


当前回答

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

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

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

其他回答

这个对我很有用: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文件。

我在尝试让composer安装一些依赖项时遇到了类似的问题。 我猜我的Wamp版本自带的。dll与64位Windows有冲突。

这个url有固定的curl dll: http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/

向下滚动到“固定卷曲扩展”部分。

我下载了“php_curl-5.4.3-VC9-x64.zip”。我只是用zip文件中的dll覆盖了wamp/bin/php/php5.4.3/ext目录中的dll,然后编写器再次工作了。

我用的是64位的Windows 8。

希望这能有所帮助。

正如Danack在评论中所说,有2个php.ini文件。我取消了在Apache文件夹中使用curl扩展的行,这是web服务器使用的php.ini。

另一方面,作曲家使用php控制台,这是一个完全不同的故事。该程序的PHP .ini文件不在Apache文件夹中,但它在PHP文件夹中,我不得不取消其中的行注释。然后我再次运行安装,它是好的。

在php 7中启用下面的命令

sudo apt-get install php7.0-curl

例如在php7上运行:

> sudo apt-get install php-curl
> sudo apt-get install php-mbstring

对于每一个缺失的扩展。然后:

> sudo apt-get update

最后(在项目的根文件夹中):

> composer install