1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

laravel homestead でPHPのバージョンを指定してcomposer installする

Posted at

詰まったのでメモがてらに。

composer install したら、PHPのバージョンが違うとかでエラーになった

色々な理由から、Homestead.yaml内に複数の記述をして複数の仮想環境を立ち上げていました。
そのうちの一つで、composer installをしようとしたらエラーに…。

エラー内容はphpのバージョンが違う

エラーの内容は、phpのバージョンが高すぎる。
7.3より下じゃないと危ないよ、と言われてました。
今のバージョンは7.4。
でも、Homestead.yaml内で、以下のように指定している・・・。

sites:
    - map: dev.hogege.test
      to: /home/vagrant/hogege/public
      php: "7.3"

これはサイト側のPHPバージョンの設定

CLI(コマンドライン)には反映されない…。
じゃあどうすれば?

コマンドラインのバージョンを変更する

[Laravel] HomesteadでPHPのバージョンを切り替える
ここのサイトを参考に、以下を実行してみた。

php72

command not found.

なんてこった。

そもそもphp72自体が効かない

バージョン情報自体も効かない…。
でも

php7.2

だと動く…。

バージョンを指定してcomposer installを実行

実行した。

php7.2 /usr/local/bin/composer install

通った。

なぜphp72が通らないのかは要調査です……。

1
2
2

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
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?