2

I try to deploy my laravel app to heroku but while running heroku after completing all steps it show the following error enter image description here

My ht access file is

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Karthiga
  • 859
  • 2
  • 17
  • 33
  • Does the server have the right privileges to read and create temporary files in the app directory? – Amarnasan Mar 01 '17 at 13:57
  • I am using xampp server... I have access to create temporary files – Karthiga Mar 01 '17 at 14:00
  • Be sure to add `Options +FollowSymLinks` – Will B. Mar 01 '17 at 14:01
  • 1
    Yes, you have access, but... what about the user running the server? – Amarnasan Mar 01 '17 at 14:02
  • Is this issue related to: http://stackoverflow.com/q/38556113/1144627 by chance? What do your error log files show? – Will B. Mar 01 '17 at 14:06
  • @fyrye yes the same issue but where the procfile is located – Karthiga Mar 01 '17 at 14:07
  • @Amarnasan yes the server is running – Karthiga Mar 01 '17 at 14:09
  • The server is running, but maybe the user of the server (which probable it's not you) doesn't hace the needed privileges – Amarnasan Mar 01 '17 at 14:12
  • What @Amarnasan is trying to point out is Apache runs as a certain user and user group, normally `apache`, `www`, or `web` That user group needs permission commonly done on Linux with `chgrp -R apache /path/to/web` Then with `find /path/to/web -type d -exec chmod +rx {} \;`. For procfile see: https://devcenter.heroku.com/articles/deploying-php#the-procfile – Will B. Mar 01 '17 at 14:21
  • See the solution to this issue [here](https://stackoverflow.com/a/48538467/5527105) – Pila Jan 31 '18 at 10:03

5 Answers5

2

Creating a Procfile By default, Heroku will launch an Apache web server together with PHP to serve applications from the root directory of the project. However, your application’s document root is the public/ subdirectory, so you need to create a Procfile that configures the correct document root:

On terminal of project directory, perform following (for Windows)

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

then do Git add, Commit, Push -Source Heroku Documentation

Sankalp
  • 76
  • 1
  • 8
0

I think the problem is here:

access here, or in any related virtual host.
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all denied
 </Directory>

 <Directory /usr/share>
    AllowOverride None
    Require all granted
 </Directory>

 <Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
 </Directory>

The key point is

Require all denied

You should change the denied to granted

JWang
  • 181
  • 6
0

Did you deploy the app on Heroku correctly? Can you check whether you did the following things?

  1. Create Heroku App
  2. Create Procfile On Root Directory Of Project
  3. Modify composer.json
  4. Get Your Project Files Up-to-date
  5. Add Your Project Files To Heroku
  6. Setup Database Connections *

If you have missed any step, do it and try again. The complete guidance to Deploy, Build, Run, and Operate Laravel Applications On Heroku Cloud Application Platform is included in the following blog article with all the steps and information you need.

Read: Laravel: Deploy Laravel Projects On Heroku

https://www.ashenlive.com/blog/laravel-deploy-laravel-projects-on-heroku

Thilina Ashen Gamage
  • 1,367
  • 1
  • 12
  • 21
0

I got the same issue and found a solution. It is about Heroku can't find an index file (index.php,index.html) in the directory. For example, if you can't reach files under the root directory, you should add an index file there. In my case, I had a root directory and had an index.php file so I could reach the files in it. But also there was another folder under the root directory which I couldn't enter. So I created an empty index.html file there too.

Then the issue was solved.

Mihail Duchev
  • 4,691
  • 10
  • 25
  • 32
0

in Procfile you have edit it and replace the code to

web: heroku-php-apache2 public/

now update your Procfile by this commend in cmd

  1. git status
  2. git add -A
  3. git commit -m "Add Procfile and make use of Apache2"
  4. git push heroku master

I hope it will be fixed