在共享主机上安装作曲家 [英] installing composer on a shared host

查看:60
本文介绍了在共享主机上安装作曲家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试首次在共享主机上安装composer。



当我运行 curl -sS https:// getcomposer .org / installer | php
我成功安装了Composer

用户: php composer.phar



当我运行 php composer.phar 时,出现此错误:



警告:应该通过CLI的PHP版本而不是cgi-fcgi SAPI来调用Composer



有关如何修复的任何想法这个 ?为什么我会收到此错误? :(



当我运行 php -v 时,我会把它找回来

  PHP 5.4.39(cgi-fcgi)(建于:2015年3月25日14:20:20)
版权所有(c)1997-2014 The PHP Group
Zend Engine v2.4.0,版权所有(c)1998-2014 Zend Technologies
和Zend Guard Loader v3.3,版权所有(c)1998-2013,由Zend Technologies

是否需要使用CLI版本运行此程序?



任何帮助都将非常感谢。

解决方案

我通过显式调用版本来解决此问题请记住,在共享服务器环境中,通常会运行多个版本的PHP,即使您可能已在cPanel配置中设置了默认版本,bash命令也经常解析为另一个(较低)版本。 / p>

首先,我创建了一个 bin 目录并将composer.phar移入其中,然后将该别名添加到了.bash_profile及其像魅力一样工作:

  alias composer = / usr / php / 54 / usr / bin / php-cli〜/ bin /composer.phar 

希望这会有所帮助!


I am trying to install composer on my shared host for the first time.

When I run curl -sS https://getcomposer.org/installer | php I am getting a Composer successfully installed
User it: php composer.phar

when I run php composer.phar i am getting this warring error:

Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI

any ideas on how to fix this ? and why i am getting this error ? :(

when I run php -v i get this back

PHP 5.4.39 (cgi-fcgi) (built: Mar 25 2015 14:20:20)  
Copyright (c) 1997-2014 The PHP Group  
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies  
    with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

Do I need to run this using CLI version if so how would i do this ?

Any help would be nice thank you.

解决方案

I resolved this by explicitly calling the version of PHP it asked for. Keep in mind that on a shared server environment there is often multiple versions of PHP running and even though you may have set up your default in your cPanel config, bash commands often resolve to another (lower) version.

First, I created a bin directory and moved composer.phar into it. Then, I added this alias to my .bash_profile and it worked like a charm:

alias composer="/usr/php/54/usr/bin/php-cli ~/bin/composer.phar"

Hope this helps!

这篇关于在共享主机上安装作曲家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆