Reputation: 18158
I have set up a new symfony 4 project that I am trying to deploy on heroku. I have the app set up and running successfully locally. I bascially followed the instructions from the heroku tutorial here. However, this tutorial is only written for symfony versions 2 and 3.
I had set up a symfony 3 app in the past successfully, I had to create a Procfile to direct the heroku server to the web/
directory, as per the instructions in the "Best Practices" section. In this S4 installation I don't see a web/
folder, so I didn't create a Procfile. Heroku uses a default command in this case.
I have created 2 config vars in heroku config
: APP_ENV, SYMPHONY_ENV both are set to prod
. I deploy the app the heroku, it all deployed successfully, but when I try to access the page, I just get a 403 Forbidden
. In the logs I get this, which is maybe the correct functionality since I didn't write any code yet:
[autoindex:error] [pid 116:tid 139699079337728] [client 10.5.228.216:17171] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
I don't see an app
folder, but I do see a folder called public
with an index file inside.
Does anyone have experience deploying the new version of Symfony 4 to Heroku, if so any tips would be greatly appreciated. Thanks!
Upvotes: 3
Views: 1511
Reputation: 2921
In my case I defined a Procfile with the following content :
web: $(composer config bin-dir)/heroku-php-apache2 public/
But it was not enough, I had to install apache-pack with composer :
composer require apache-pack (using symfony flex) or composer require symfony/apache-pack
(I found the solution on the heroku-buildpack-php repository)
Upvotes: 1
Reputation: 746
The best solution is to create a Procfile
in the root of your repository,
with the following content:
web: $(composer config bin-dir)/heroku-php-apache2 public/
Upvotes: 0
Reputation: 1630
On Symfony 4 the web folder was replaced by public. You still need to create the Procfile file and add this line:
web: vendor/bin/heroku-php-apache2 public/
Upvotes: 1