Install composer on a shared host

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

When I ran curl -sS https://getcomposer.org/installer | php curl -sS https://getcomposer.org/installer | php I get composer successfully installed
User: php composer.phar

when I run php composer.phar , I get this belligerent error:

Warning: Composer must be called via the CLI version for PHP, not cgi-fcgi SAPI

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

when i run php -v i will go 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 the CLI version, if so, how would I do this?

Any help would be enjoyable.

+6
source share
1 answer

I solved this by explicitly invoking the version of PHP he requested. Keep in mind that in a shared server environment several versions of PHP are often run, and even if you can set your default in your cPanel configuration, bash commands are often resolved to a different (lower) version.

First, I created the bin directory and moved the composer.phar file 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!

+6
source

Source: https://habr.com/ru/post/985751/


All Articles