I am new to Heroku. Sometimes I tried to deploy an application on Heroku for Fb, but did not see success. I tried to find a solution on the Internet, but did not find a single step-by-step guide , so I ask here.
My Fb Application Code "index.php"
<?php session_start(); require_once __DIR__ . '/fbsdk/autoload.php'; $fb = new Facebook\Facebook([ 'app_id' => '************', 'app_secret' => '**********', 'default_graph_version' => 'v2.4',]); $helper = $fb->getCanvasHelper(); $permissions = ['email']; try { if (isset($_SESSION['facebook_access_token'])) { $accessToken = $_SESSION['facebook_access_token']; } else { $accessToken = $helper->getAccessToken(); } } catch(Facebook\Exceptions\FacebookResponseException $e) { } catch(Facebook\Exceptions\FacebookSDKException $e) { } if (isset($accessToken)) { if (isset($_SESSION['facebook_access_token'])) { $fb->setDefaultAccessToken($_SESSION['facebook_access_token']); } else { $_SESSION['facebook_access_token'] = (string) $accessToken; $oAuth2Client = $fb->getOAuth2Client(); $longLivedAccessToken = $oAuth2Client->getLongLivedAccessToken($_SESSION['facebook_access_token']); $_SESSION['facebook_access_token'] = (string) $longLivedAccessToken; $fb->setDefaultAccessToken($_SESSION['facebook_access_token']); } try { $request = $fb->get('/me'); } catch(Facebook\Exceptions\FacebookResponseException $e) { if ($e->getCode() == 190) { unset($_SESSION['facebook_access_token']); $helper = $fb->getRedirectLoginHelper(); $loginUrl = $helper->getLoginUrl('https://apps.facebook.com/APP_NAMESPACE/', $permissions); echo "<script>window.top.location.href='".$loginUrl."'</script>"; exit; } } catch(Facebook\Exceptions\FacebookSDKException $e) { } try { $requestPicture = $fb->get('/me/picture?redirect=false&height=300'); $requestProfile = $fb->get('/me'); $picture = $requestPicture->getGraphUser(); $profile = $requestProfile->getGraphUser(); } catch(Facebook\Exceptions\FacebookResponseException $e) { } catch(Facebook\Exceptions\FacebookSDKException $e) { } echo "<img src='".$picture['url']."'/>"; } else { $helper = $fb->getRedirectLoginHelper(); $loginUrl = $helper->getLoginUrl('https://apps.facebook.com/APP_NAMESPACE/'); echo "<script>window.top.location.href='".$loginUrl."'</script>"; }
"composer.json"
{}
Commands I Used in Git Bash
heroku create AppName mkdir AppName cd AppName git init git add . git commit -m "comment" heroku git:remote -a AppName git push heroku master git branch git commit -am "comment" git push heroku master
Everything is going well, the hero compiles PHP files, expands the file. But when I open the Fb application or even the address of the heroku application, it shows the message ** 403 Forbidden fbapp-2.herokuapp.com
Directory structure 
Buildpacks installed as heroku / php
I don't have a procfile or .htaccess file
Hero magazines show
State changed from starting to up 2016-04-05T15:30:14.413923+00:00 heroku[router]: at=info method=GET path="/" host=fbapp-2.herokuapp.com request_id=ea94baf1-a433-4631-bbe5-7493cb7e137f wd="43.230.135.148" dyno=web.1 connect=0ms service=3ms status=403 bytes=373 2016-04-05T15:30:14.399879+00:00 app[web.1]: [Tue Apr 05 15:30:14.395964 2016] [autoindex:error] [pid 82:tid 139840075028224] [client 1.3.2.3:58066] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive 2016-04-05T15:30:14.400023+00:00 app[web.1]: 1.3.2.3 - - [05/Apr/2016:15:30:14 +0000] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 OPR/36.0.2130.46 2016-04-05T15:30:14.873648+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=fbapp-2.herokuapp.com request_id=8b65b3b6-2f82-4ab4-abb4-d4849c1ec225 fwd="43.230.135.148" dyno=web.1 connect=0ms service=1ms status=404 bytes=373 2016-04-05T15:30:14.856297+00:00 app[web.1]: 1.3.2.3 - - [05/Apr/2016:15:30:14 +0000] "GET /favicon.ico HTTP/1.1" 404 209 "http://fbapp-2.herokuapp.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 OPR/36.0.2130.46
source share