【发布时间】:2021-03-27 06:08:07
【问题描述】:
它在我的 lohalhost 中运行良好,当我尝试放在服务器上时发生此错误。
在 index.php 中
<?php defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/_protected/vendor/autoload.php'); require(__DIR__ . '/_protected/vendor/yiisoft/yii2/Yii.php'); require(__DIR__ . '/_protected/common/config/bootstrap.php'); require(__DIR__ . '/_protected/frontend/config/bootstrap.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/_protected/common/config/main.php'),
require(__DIR__ . '/_protected/common/config/main-local.php'),
require(__DIR__ . '/_protected/frontend/config/main.php'),
require(__DIR__ . '/_protected/frontend/config/main-local.php') );
$application = new yii\web\Application($config); $application->run();
.htaccess
RewriteEngine on
# hide files and folders
RedirectMatch 404 /_protected
RedirectMatch 404 /\.git
RedirectMatch 404 /composer\.
RedirectMatch 404 /.bowerrc
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
【问题讨论】:
-
您使用的是 Apache 吗?你启用php了吗?运行 apache2ctl -M 并检查结果中是否有 php 行。
-
什么错误?没有提供异常/错误字符串
标签: php ubuntu yii2 apache2 yii2-advanced-app