Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy Laravel 4 Apps on Heroku?

I know that Heroku supports many different environments in the Cedar stack including PHP.
The tipical folder structure of a Laravel 4 app is the following:

app/
bootstrap/
public/
    packages/
    index.php
vendor/
composer.json
phpunit.xml

Note 2 things:

  1. The main index.php file is not located in the root, is under the public folder.

  2. There is a composer.json file and Heroku needs to install all the project dependencies automatically just like gems in Ruby apps.

So my question is:
Is there a way to deploy this kind of apps on Heroku ??

Any help appreciated.

like image 722
Javier Cadiz Avatar asked Feb 16 '13 08:02

Javier Cadiz


People also ask

Can I deploy Laravel app on Heroku?

Deploying to Heroku After you've done that, you're going to create an application instance on Heroku, configure some Laravel environment variables, and then simply git push to deploy your code!


1 Answers

You'll need to use a custom buildpack to set the document root and executes a script that integrates composer too. In Heroku's Buidlpack you would need to update the bin/compile script to handle composer and conf/httpd.conf to set the document root. Also, Heroku's buildpack does not have mcrypt compiled in, so Laravel 4 won't work with that buildpack. I've included many updates that include mcrypt, composer, and custom document roots in my branch of the buildpack.

like image 188
Wing Lian Avatar answered Oct 18 '22 02:10

Wing Lian