Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question