duanao6704
2017-06-02 07:56
浏览 211
已采纳

在CentOS 7上安装PHP Composer失败

I'm trying to install Magento 2.1 using PHP composer.

http://idroot.net/tutorials/how-to-install-php-composer-on-centos-7/

I found the url above to install PHP composer for Centos 7.

on step 2 it failed:

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

this is the error I get

"curl: (6) Could not resolve host: php; Name or service not known

Thanks for the help guys!

图片转代码服务由CSDN问答提供 功能建议

我正在尝试使用PHP编曲器安装Magento 2.1。

< a href =“http://idroot.net/tutorials/how-to-install-php-composer-on-centos-7/”rel =“nofollow noreferrer”> http://idroot.net/tutorials/how- to-install-php-composer-on-centos-7 /

我在上面找到了为Centos 7安装PHP编写器的URL。

在第2步失败了:

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

这是我得到的错误

“curl:(6)无法解析主机 :php;名称或服务未知

感谢帮助人员!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • doulong1987 2017-06-02 08:05
    已采纳
    wget https://getcomposer.org/composer.phar
    chmod +x composer.phar
    mv composer.phar /usr/local/bin/composer
    
    点赞 打赏 评论
  • dpfw3607 2017-06-02 07:59

    Already tried with composer's documentation?

    This method?

    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
    

    Or just tried with the download page:

    点赞 打赏 评论
  • dongzi3805 2017-06-02 08:14

    What don't you use yum instead of manual installation? Use follow command:

    yum install php71w-composer

    you can replace php71w with other version as you like, such as php55w is php 5.5, php56w is php 5.6, php70w is php 7.0 and so on.If you meet the error message like "package php71w-composer not found", install webtatic repository follow by this.

    点赞 打赏 评论

相关推荐 更多相似问题