Yii2 app does not appear in Heroku domain

I installed the Yii2 "main" application on the Cloud9 workspace using composer. It works great, as you can see here https://portfolio-php--dfmmalaw.c9.io/basic/web/index.php

Problem: I get below errors when trying to view after deployment on Heroku URLs.

"Forbidden. You do not have permission to access this server."

Below is a screenshot - my Cloud9 cloud space http://prntscr.com/8rrkn0

I even tried adding basic / web / index.php to the Heroku URL, but I just got a blank page. What am I doing wrong?

+7
php yii yii2 heroku
source share
2 answers

After getting help from Herokai, David Zuelke, I decided to create a practical guide on “Creating a Yii2 app on Cloud9 → Pushing to Github → Deploymenting to Heroku”. See below (google doc link at the top if easier to read):

https://docs.google.com/document/d/15teHaGWUWSNW_VwdV3-7bVpQHNRv2G0Z8GPFbIB-ogs/edit

1) Create the "main" Yii2 application:

290795 $ composer create-project --prefer-dist yiisoft/yii2-app-basic basic 

2) Go to the "base" directory

 290795 $ cd basic/ 

3) Initialize a local repo for the "base" directory

 basic $ git init 

4) Add and transfer the Yii project

 basic $ git add . basic $ git commit -m "basic Yii project" 

5) Add a procfile that points to index.php (script entry) in the "web" directory

 basic $ echo "web: vendor/bin/heroku-php-apache2 web/" > Procfile basic $ git add Procfile basic $ git commit -m "Procfile for Heroku" 

6) Comment on the debugging information (I do it manually, not from the command line)

 basic $ vim web/index.php # remove dev/debug env stuff (not my way) basic $ git add web/index.php basic $ git commit -m "remove dev/debug env" 

7) This updates the dependency from v1.0.3 to v1.1 (an absolute must)

 basic $ composer require fxp/composer-asset-plugin basic $ git add composer.json composer.lock basic $ git commit -m "use fxp/composer-asset-plugin in project" 

8) Create a Heroku app and click on it. (Instead, I create and click on the Github repository)

 basic $ heroku create basic $ git push heroku master (again I push to Github Repo synced with Heroku) 

9) Add an entry to Heroku for the Yii application (without registering for Yii from the box)

 basic $ echo "web: vendor/bin/heroku-php-apache2 -l runtime/logs/app.log web/" > Procfile basic $ git add Procfile basic $ git commit -m "tail runtime/logs/app.log" basic $ git push heroku master (again I push to Github Repo synced with Heroku) 

10) This allows you to work with the Contact page (not sure why)

 basic $ composer require ext-gd:* --ignore-platform-reqs basic $ git add composer.json composer.lock basic $ git commit -m "require GD for contact CAPTCHA" basic $ git push heroku master (again I push to Github Repo synced with Heroku) 
+5
source share

The easiest way is to check your apache logs. I have no experience with Heroku, but I am sure that they offer access to them. Just take a look there and you will see what the problem is. A white page usually means that it was a catastrophic mistake.

Another thing to pay attention to is to use short php tags. You should not and, as a rule, this is a more relaxed setting on your computer, but more strict on hosting servers. But look at the magazines again, they will also tell you about it.

This is for an extended template, so not for you: I think you did not run "php init" as indicated in the documentation. The init command is not only the first time you get the application, but every time you install it on a new server. it creates index.php files and other configuration files that you will need. Just follow the installation instructions for yii2 http://www.yiiframework.com/doc-2.0/guide-start-installation.html

0
source share

All Articles