LoginSignup
1

More than 5 years have passed since last update.

レンタルサーバーの「Value Server」でComposerを利用する方法

Last updated at Posted at 2017-07-11

条件

手順

Composerは標準でインストールされているが、そのまま実行するとエラーが出る。

$ composer

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug


  [ErrorException]                         
  Invalid argument supplied for foreach()  

CLI版から実行すると動作する。

$ which composer
/usr/bin/composer

php5.6

$ php56cli /usr/bin/composer

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev (f25446e507a3f420b2b88e6dedc47787d42ea7e9) 2015-12-15

php7.1

$ php71cli /usr/bin/composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev (f25446e507a3f420b2b88e6dedc47787d42ea7e9) 2015-12-15

Composerのバージョンを最新にする

標準でインストールされているものはバージョンが古いため、最新版にしたい場合はダウンロード
する。

$ curl -sS https://getcomposer.org/installer | php71cli

All settings correct for using Composer
Downloading...

Composer (version 1.4.2) successfully installed to: /virtual/culture24/composer.phar
Use it: php composer.phar

最新版を実行してみる。

$ php71cli composer.phar

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.4.2 2017-05-17 08:17:52

.bashrcへエイリアスを登録してcomposerコマンドで利用可能とする。

$ vi .bashrc

#追記
alias composer='php71cli ~/composer.phar'

$ source ./.bashrc

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
1