Laravel 5 Heroku Local doesn't work

前端 未结 3 1849
醉话见心
醉话见心 2020-12-19 23:44

I\'ve successfully deployed the Laravel application to Heroku.

It works online.

But when I try to run \"heroku local\" I get:

vendor

相关标签:
3条回答
  • 2020-12-20 00:25

    After extensive research, trial and error and talking to the Heroku Support team, I found out that, although Slow Loris's answer was a part of the process, the following answer was given to me by Heroku's Support:

    To cut a long story short, heroku local is not officially supported for PHP >applications. The reason is that unlike all the other languages we support on the >platform, PHP has no web servers written in userland. Instead, we use PHP-FPM >together with Apache or Nginx, and the boot scripts (vendor/bin/heroku-(php|hhvm)-(apache2|nginx)) dynamically inject the correct configuration for port >binding and the FastCGI comms sockets.

    This works with vanilla PHP and Apache builds, provided that:

    1) the current user has all the correct permissions (in your case, >/var/log/apache2/ isn't writable); 2) the correct proxy modules are loaded in the main httpd.conf; 3) the main httpd.conf doesn't bind to a port at all, or at least not to one >under 1024 (which are reserved for superusers).

    The main config also needs to be handled by each user on their own, because >sometimes, the modules to be loaded are in libexec/, sometimes in >lib/apache2/modules/, and so forth. Just too many variations; otherwise, we could >ship a full Apache config to users and the experience would be much better.

    But the problems don't end there. FPM does not work at all on Windows, and on >most Linux systems, httpd is not a command that works; instead, apache2ctl >handles starting and stopping, and thus, running a server in the foreground is >not possible. In the end, there are simply too many possible permutations in >system configs that make it impossible to ensure every user has a great >experience.

    It's simply the current reality in PHP land. Ruby, Python, Node, Java all have >web servers that are written in each respective language, and you don't need >external servers. Which also makes it possible to stream file uploads, handle web >socket upgrades, and so forth. Maybe with PHP 7 we'll see something like that >emerge soon (in PHP 5 it's simply not feasible at all, because a fatal error >kills the engine, so your web server would be gone too).

    0 讨论(0)
  • 2020-12-20 00:39

    I know this question is a little dated but I recently deployed a heroku app for the first time and was unable to get heroku local to work for me. I'm on the current branch of Laravel which is 5.8, I am also on Windows 10 using VS Code. I searched all over trying to rectify this issue and could not get it to work no matter what.

    I did come up with a solution to be able to work on this locally with only a few lines in terminal.

    In VS Code, I used gitbash terminal, once in my heroku project folder composer require laravel/homestead --dev, once that is complete, then we need to install homestead, vendor/bin/homestead make, and then once that is complete, simply run vagrant up and your app will be accessible through localhost:8000.

    Docs - https://laravel.com/docs/5.8/homestead

    Hope this helps someone!

    0 讨论(0)
  • 2020-12-20 00:47

    You should have these lines in your composer.json

    "require-dev": {
        "heroku/heroku-buildpack-php": "*"
     }
    

    be sure to run composer update after you add them.

    0 讨论(0)
提交回复
热议问题