LoginSignup
16
16

More than 5 years have passed since last update.

Laravel4 on Heroku

Last updated at Posted at 2014-06-17

はじめに

最新フレームワークのLaravel4をHeroku上にデプロイしたいと思います。

必須環境

  • PHP >= 5.4
  • MCrypt PHP Extension
  • バンドルされてない場合、php5-json(Ubuntu $apt-get install php5-json)

プロジェクトの作成

composer create-project laravel/laravel --prefer-dist appname

.gitignoreを編集

Laravelのデフォルトでは.gitignoreにcomposer.lockが含まれていますので、
composer.lockの行を削除して管理対象にします。
気にしないでトライしたら、下記メッセージで怒られました。

 !ERROR:Your composer.json specifies dependencies, but no composer.lock was found, please check it into your repository along with composer.json!

.gitignore
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock <= 削除
.env.*.php
.env.php
.DS_Store
Thumbs.db

参考文献:https://github.com/laravel/framework/issues/1412

ドキュメントルート変更

ドキュメントルートの変更を行うためにプロジェクト直下にProcfileを作成します。

Procfile
web: vendor/bin/heroku-php-apache2 public/

参考文献:https://devcenter.heroku.com/articles/custom-php-settings#setting-the-document-root

レポジトリ作成

  1. git init
  2. git add .
  3. git commit -m "Init"

Herokuアプリケーション作成

$cd appname
$heroku create appname
$git push heroku master

You have arrived!

arrived.png

16
16
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
16
16