简体   繁体   English

如何在Heroku上部署Laravel 4 Apps?

[英]How to deploy Laravel 4 Apps on Heroku?

I know that Heroku supports many different environments in the Cedar stack including PHP . 我知道Heroku在Cedar堆栈中支持许多不同的环境,包括PHP
The tipical folder structure of a Laravel 4 app is the following: Laravel 4应用程序的典型文件夹结构如下:

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

Note 2 things: 注意2件事:

  1. The main index.php file is not located in the root, is under the public folder. index.php文件不在根目录中,位于公用文件夹下。

  2. There is a composer.json file and Heroku needs to install all the project dependencies automatically just like gems in Ruby apps. 有一个composer.json文件,Heroku需要自动安装所有项目依赖项,就像Ruby应用程序中的gems一样。

So my question is: 所以我的问题是:
Is there a way to deploy this kind of apps on Heroku ?? 有没有办法在Heroku上部署这种应用程序?

Any help appreciated. 任何帮助表示赞赏。

You'll need to use a custom buildpack to set the document root and executes a script that integrates composer too. 您将需要使用自定义buildpack来设置文档根目录,并执行一个集成了composer的脚本。 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. Heroku的Buidlpack中,您需要更新bin / compile脚本以处理composer,并需要更新conf / httpd.conf来设置文档根目录。 Also, Heroku's buildpack does not have mcrypt compiled in, so Laravel 4 won't work with that buildpack. 另外,Heroku的buildpack中没有编译mcrypt,因此Laravel 4无法与该buildpack一起使用。 I've included many updates that include mcrypt, composer, and custom document roots in my branch of the buildpack . 在buildpack的分支中包含了许多更新,其中包括mcrypt,composer和自定义文档根目录。

Heroku has recently released a official PHP buildpack https://github.com/heroku/heroku-buildpack-php . Heroku最近发布了一个官方的PHP buildpack https://github.com/heroku/heroku-buildpack-php It's new and i had some initial troubles with it. 它是新的,我对此有些麻烦。 but it should improve. 但它应该改善。 It supports PHP or HHVM. 它支持PHP或HHVM。

Its possible to specify your application's entry point in an Procfile, place it in in the root directory of your application. 可以在Procfile中指定应用程序的入口点,并将其放置在应用程序的根目录中。 In your case the contents would be: 在您的情况下,内容为:

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

https://devcenter.heroku.com/articles/getting-started-with-php#define-a-procfile https://devcenter.heroku.com/articles/getting-started-with-php#define-a-procfile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM