Answer the question
In order to leave comments, you need to log in
Why can't $application->run(); in YII2?
Transferred the project to yii2 from local to hosting. In frondend/web/index.php the last line does not work, namely
$application->run();
rather it works weird. Displays run();
Conducted an experiment, changed index.php:
<?php
echo "1";
defined('YII_DEBUG') or define('YII_DEBUG', false);
echo "2";
defined('YII_ENV') or define('YII_ENV', 'prod');
echo "3";
require(__DIR__ . '/../../vendor/autoload.php');
echo "4";
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
echo "5";
require(__DIR__ . '/../../common/config/bootstrap.php');
echo "6";
require(__DIR__ . '/../config/bootstrap.php');
echo "7";
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../common/config/main.php'),
require(__DIR__ . '/../../common/config/main-local.php'),
require(__DIR__ . '/../config/main.php'),
require(__DIR__ . '/../config/main-local.php')
);
echo "8";
$application = new yii\web\Application($config);
echo "9";
$application->run();
echo "10";
Answer the question
In order to leave comments, you need to log in
Turn on the logs and see where the error is. It is possible that 5.4 was enabled, and .htaccess was lost during the transfer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question