安装作曲家时遇到问题

时间:2013-01-21 11:23:58

标签: php composer-php

我正在使用以下cammand安装composer

curl -s https://getcomposer.org/installer | php

但我一直低于错误消息

Zafars-MacBook-Pro:etc zafarsaleem$ curl -s https://getcomposer.org/installer | php
#!/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 detect_unicode setting must be disabled.
Add the following to the end of your `php.ini`:
detect_unicode = Off

A php.ini file does not exist. You will have to create one.

如何安装composer才能删除上述错误?

修改

Zafars-MacBook-Pro:etc zafarsaleem$ php --ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

最新修改

经过一些研究后,我发现正在使用的php.ini文件位于/etc/php.ini。但是,当我在/etc文件夹中检查此文件时,它不存在。 /etc文件夹包含php.ini.default文件夹,该文件夹链接到/private/etc/php.ini.default。因此,我在detect_unicode = Off中添加了/etc/php.ini.default,并将此文件重命名为php.ini。现在我执行下面的命令

curl -s https://getcomposer.org/installer | php

OR

sudo curl -s https://getcomposer.org/installer | php

然后我得到以下错误

Zafars-MacBook-Pro:/ zafarsaleem$ sudo curl -s https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Download failed: failed to open stream: Permission denied
Downloading...
Download failed: failed to open stream: Permission denied
Downloading...
Download failed: failed to open stream: Permission denied
The download failed repeatedly, aborting.

如何在计算机上安装composer并删除上述问题?请帮忙

6 个答案:

答案 0 :(得分:106)

要在MacOSX上下载/安装,您可以执行following steps 尝试以下homebrew步骤:

  1. 转到您可以写入的目录:

    cd~

  2. 得到作曲家:

    curl -sS https://getcomposer.org/installer | PHP

  3. 将composer移动到$ PATH var:

    中的bin目录中

    sudo mv composer.phar / usr / local / bin / composer

  4. 双重检查作曲家的作品

    作曲家关于

  5. (可选)更新作曲家:

    sudo composer self-update

  6. <强> Homebrew

    brew update
    brew tap homebrew/homebrew-php
    brew tap homebrew/dupes
    brew tap homebrew/versions
    brew install php55-intl
    brew install homebrew/php/composer
    

答案 1 :(得分:31)

尝试使用此选项并动态更改设置,仅适用于此命令

curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off

答案 2 :(得分:5)

在Ubuntu Vivid 15.04中。尝试: 步骤进行:

  1. 打开终端并写入: sudo su ,然后按Enter键。
  2. 粘贴: curl -sS https://getcomposer.org/installer | php 和 按Enter键。 (这个安装作曲家,等待完成)
  3. 最后写退出
  4. 注意:抱歉,我的英语不好:(

答案 3 :(得分:3)

我有同样的错误。我最终在php端添加了sudo,它对我有用。

curl -sS https://getcomposer.org/installer | sudo php

答案 4 :(得分:2)

如果您的系统中没有卷曲,您仍然可以使用以下命令安装composer

转到可以编写的目录,

cd yourDirectory

php -r "readfile('https://getcomposer.org/installer');" | php -d detect_unicode=off

答案 5 :(得分:0)

sudo curl -sS https://getcomposer.org/installer | sudo php - --install-dir = / usr / local / bin

运行此命令它会起作用,所以我认为:D