我正在安装具有以下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
文件夹包含链接到/private/etc/php.ini.default
的php.ini.default
文件夹。所以我在/etc/php.ini.default
中添加了detect_unicode = Off
,并将该文件重命名为php.ini
。现在,当我执行以下命令时
curl -s https://getcomposer.org/installer | php
或
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并解决上述问题?请帮助
要在MacOSX上下载/安装,您可以执行以下步骤或尝试以下自制步骤:
-
转到可以写入的目录:
cd ~
-
获取作曲家:
卷曲-sShttps://getcomposer.org/installer|php
-
将composer移动到$PATH var:中的bin目录中
sudo mv composer.phar/usr/local/bin/composer
-
仔细检查作曲家作品
作曲家关于
-
(可选(更新编辑器:
sudo composer自更新
自制
brew update
brew tap homebrew/homebrew-php
brew tap homebrew/dupes
brew tap homebrew/versions
brew install php55-intl
brew install homebrew/php/composer
试试这个,然后动态更改设置,只针对这个命令
curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off
在Ubuntu Vivid 15.04中。尝试:步骤:
- 打开终端并写入:sudo su,然后按Enter
- 粘贴此:卷曲-sShttps://getcomposer.org/installer|php和按Enter键。(此安装编辑器,等待完成(
- 最后写入退出
注意:对不起,我的英语不好:(
我也有同样的错误。我最终在php端添加了sudo,它对我很有效
curl -sS https://getcomposer.org/installer | sudo php
如果您的系统中没有curl,您仍然可以使用以下命令安装composer
转到可以写入的目录,
cd yourDirectory
php -r "readfile('https://getcomposer.org/installer');" | php -d detect_unicode=off
sudo curl-sShttps://getcomposer.org/installer| sudo php----install dir=/usr/local/bin
运行这个命令,它就会工作,所以我认为:D