2
1

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.

GitHubからpullしてきてVPSやlocalhostでLaravelが使えない時

Posted at

はじめに

VPSやLocalにGitHubからpullをしてくると、Laravelがうまく機能していないことが多い。今回はその解決策をGitHub上で管理しているリモートリポジトリにLaravelはインストールされて使えることを前提にしてこの記事を書いた。

.envを作ってあげる

GitHubからpullなどの操作によってVPSやlocalリポジトリにある**.envファイルは動作環境に対する設定値である持ってこれない。つまり手動で作る必要がある**。GitHubでバージョン管理をしている人は、**.envはバージョン管理の対象から外す必要である。**そのため、.env_exampleがあることを利用して.envファイルを作る。

terminal
$ cp .env.example .env

composerをインストールする

Laravelを動かすにはcomposerをインストールする必要がある。
以下のコマンドを実行することでインストールできる。(すこし時間がかかる)

terminal
$ ./composer.phar install

上記によってVPSおよびローカル環境でLaravelが動くようになる。

ローカルサーバーを立ち上げる(ローカル環境で開発者向け)

次のコマンドによってローカルサーバーを立ち上げることができる。

terminal
$ php artisan serve

もし仮にうまくローカルサーバーが動いてない時は以下のコマンドによってキーを作成し、再度コマンドを打つ。

terminal
$ php artisan key:generate
$ php artisan serve

である。これによってローカルサーバーによって開発ができるようになる。

2
1
0

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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?