LoginSignup
68
50

More than 5 years have passed since last update.

Homesteadで画面起動したら「No input file specified.」になった時の対処法

Posted at

昨日に弾き続けLaravelの開発環境構築関連ネタを。

https://qiita.com/ymk1102_1t/items/e8f61fd38d08b87ebef2

1つ目の環境を発生していたので今2つ目を作っている時もスムーズに対応できたんですが、ハマる人多そうなので残しておく。

エラーの原因

No input file specified.

直訳すると「入力ファイルが指定されていない」という意味。
多分初期表示のディレクトリが自分の意図したものになっていないんだろうなと見込んで調査を開始。

どこのディレクトリを見にいっているかの調査

vagrant@homestead:~$ vim /var/log/nginx/〇〇-error.log
に載っていた。
※〇〇のところにはHomestead.yamlのsitesのmapに書いた内容が入るらしい。
  

2018/06/03 11:13:37 [error] 919#919: *1 FastCGI sent in stderr: 
"Unable to open primary script: /home/vagrant/code/public/index.php (No such file or directory)" 
while reading response header from upstream, client: 192.168.20.1, server: 〇〇, request: "GET / HTTP/1.1", 
upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "192.168.20.10"

エラー内容はこんな感じ。
/home/vagrant/code/public/index.php のファイルが見つからないとのこと。

実際、 ~/code で ls を投げるとLaravelというプロジェクトをまとめたフォルダが出てきてpublicというフォルダは見つからなかった。
Laravelの下に public/index.php はあったので、ディレクトリ構造の設定ミスが原因だという説が濃厚になる。

パスの設定箇所の修正

設定しているのはHomestead.yamlなのでそこを見に行きます。

sites:
    - map: homestead-test
      to: /home/vagrant/code/public

さっきのエラーの通り、Laravelのディレクトリが抜け落ちてるのでここに書き足す。

設定を反映する

vagrant up --provision

これで設定を反映できる。
再起動だけで行けると勘違いして何回も vagrant reload してしまっていたけどそっちは意味ないらしい^^;

原因特定から修正対応まではこんな感じ。

68
50
1

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
68
50