A
A
Alli_baba012019-03-07 00:39:51
Yii
Alli_baba01, 2019-03-07 00:39:51

How to fix Yii2: An internal server error occurred?

After structuring Yii2 and setting up index files, the error "An internal server error occurred" appears. but if the index is not configured correctly, swap the frontend and backend, everything works.
Example admin/index:
<?php
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
require __DIR__ . '/../../yii/vendor/autoload.php';
require __DIR__ . '/../../yii/vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../yii/common/config/bootstrap.php';
require __DIR__ . '/../../yii/ frontend /config/bootstrap.php';
$config = yii\helpers\ArrayHelper::
require __DIR__ . '/../../yii/common/config/main-local.php',
require __DIR__ . '/../../yii/ frontend /config/main.php',
require __DIR__ . '/../../yii/ frontend /config/main-local.php'
);
(new yii\web\Application($config))->run();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-03-07
@Alli_baba01

Goodnight.
Replace false with true and prod with dev. It also helps to read the logs.

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question