cannot view Yii app on Heroku after successful deployment -
i able deploy yii2 app heroku github repo. however, when try access domain provided heroku (https://portfolio-php.herokuapp.com) error saying "forbidden don't have permission access / on server." build logs provided below. can please offer guidance?
-----> php app detected -----> resolved 'composer.lock' requirement php version 5.6.14. -----> installing system packages... - php 5.6.14 - apache 2.4.17 - nginx 1.8.0 -----> installing php extensions... - mbstring (composer.lock; bundled) - zend-opcache (automatic; bundled) -----> installing dependencies... notice: using '/composer.phar' install dependencies. composer version 1.0-dev (9e67bc761be98b45875855003eb8b2f23f4bf5a5) 2015-09-18 14:32:06 loading composer repositories package information installing dependencies lock file - installing yiisoft/yii2-composer (2.0.3) loading cache - installing bower-asset/jquery (2.1.4) loading cache - installing bower-asset/jquery.inputmask (3.1.63) loading cache - installing bower-asset/punycode (v1.3.2) loading cache - installing bower-asset/yii2-pjax (v2.0.4) loading cache - installing cebe/markdown (1.1.0) loading cache - installing ezyang/htmlpurifier (v4.6.0) loading cache - installing yiisoft/yii2 (2.0.6) loading cache - installing bower-asset/bootstrap (v3.3.5) loading cache - installing yiisoft/yii2-bootstrap (2.0.4) loading cache - installing swiftmailer/swiftmailer (v5.4.1) loading cache - installing yiisoft/yii2-swiftmailer (2.0.4) loading cache generating optimized autoload files -----> preparing runtime environment... notice: no procfile, using 'web: vendor/bin/heroku-php-apache2'. -----> discovering process types procfile declares types -> web -----> compressing... done, 80.9mb -----> launching... done, v12 https://portfolio-php.herokuapp.com/ deployed heroku
i using basic yii2 template. there no htaccess file , config file reads:
<?php $params = require(__dir__ . '/params.php'); $config = [ 'id' => 'basic', 'basepath' => dirname(__dir__), 'bootstrap' => ['log'], 'components' => [ 'request' => [ // !!! insert secret key in following (if empty) - required cookie validation 'cookievalidationkey' => 'gfwix3xdsocyeuve6vvm1kf4vayt0z7t', ], 'cache' => [ 'class' => 'yii\caching\filecache', ], 'user' => [ 'identityclass' => 'app\models\user', 'enableautologin' => true, ], 'errorhandler' => [ 'erroraction' => 'site/error', ], 'mailer' => [ 'class' => 'yii\swiftmailer\mailer', // send mails file default. have set // 'usefiletransport' false , configure transport // mailer send real emails. 'usefiletransport' => true, ], 'log' => [ 'tracelevel' => yii_debug ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\filetarget', 'levels' => ['error', 'warning'], ], ], ], 'db' => require(__dir__ . '/db.php'), ], 'params' => $params, ]; if (yii_env_dev) { // configuration adjustments 'dev' environment $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\module', ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\module', ]; } return $config;
if app called basic, url should work:
https://portfolio-php.herokuapp.com/basic/web
how basic app working in domain/
1) move files /web directory public_html or whatever
2) put rest of files in upper level, that:
[...] commands config controllers models web (empty) ... public_html - assets - index.php - css - [...]
3) change index.php you've moved /public_html , change paths config files, vendor, etc.
4) create .htaccess in directory following:
options +followsymlinks -indexes indexignore */* rewriteengine on # if directory or file exists, use directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # otherwise forward index.php
====
update
check if https://portfolio-php.herokuapp.com/basic/requirements.php works, if not, should reinstall composer dependencies:
backup vendor folder , composer.lock
delete files in vendor folder
do
composer install --prefer-dist
Nice articel about cannot view Yii app on Heroku after successful deployment , This article help me very well. Thank you. Also please check my article on my site Know All About Htaccess Tutorial. In link article we will learn about htaccess File.
ReplyDelete