从gitlab运行yii2应用程序将无法正常工作
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从gitlab运行yii2应用程序将无法正常工作相关的知识,希望对你有一定的参考价值。
我在运行我的Yii2应用程序时遇到问题。它在我的计算机上工作正常,即localhost但是当从git实验室中取出时它没有运行。错误是 -
An Error occurred while handling another error exception 'yiiaseInvalidRouteException' with message 'Unable to resolve the request: site/error' in /var/www/html/jd4test/vendor/yiisoft/yii2/base/Controller.php:127 Stack trace:
#0 /var/www/html/jd4test/vendor/yiisoft/yii2/base/Module.php(523): yiiaseController->runAction('error', Array)
#1 /var/www/html/jd4test/vendor/yiisoft/yii2/web/ErrorHandler.php(95): yiiaseModule->runAction('site/error')
#2 /var/www/html/jd4test/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yiiwebErrorHandler->renderException(Object(yiiwebNotFoundHttpException))
#3 [internal function]: yiiaseErrorHandler->handleException(Object(yiiwebNotFoundHttpException))
#4 {main} Previous exception: exception 'yiiaseInvalidRouteException' with message 'Unable to resolve the request: site/' in /var/www/html/jd4test/vendor/yiisoft/yii2/base/Controller.php:127 Stack trace:
#0 /var/www/html/jd4test/vendor/yiisoft/yii2/base/Module.php(523): yiiaseController->runAction('', Array)
#1 /var/www/html/jd4test/vendor/yiisoft/yii2/web/Application.php(102): yiiaseModule->runAction('', Array)
#2 /var/www/html/jd4test/vendor/yiisoft/yii2/base/Application.php(380): yiiwebApplication->handleRequest(Object(yiiwebRequest))
#3 /var/www/html/jd4test/web/index.php(12): yiiaseApplication->run()
#4 {main}
Next exception 'yiiwebNotFoundHttpException' with message 'Page not found.' in /var/www/html/jd4test/vendor/yiisoft/yii2/web/Application.php:114 Stack trace:
#0 /var/www/html/jd4test/vendor/yiisoft/yii2/base/Application.php(380): yiiwebApplication->handleRequest(Object(yiiwebRequest))
#1 /var/www/html/jd4test/web/index.php(12): yiiaseApplication->run()
#2 {main}
现在,在它在本地主机上工作的状态之后发生了一些变化,就像在web.php配置文件中添加的规则一样 -
'urlManager' => [
'class' => 'yiiwebUrlManager',
// Disable index.php
'showScriptName' => false,
// Disable r= routes
'enablePrettyUrl' => true,
'rules' => array(
'<controller:w+>/<id:d+>' => '<controller>/view',
'<controller:w+>/<action:w+>/<id:d+>' => '<controller>/<action>',
'<controller:w+>/<action:w+>' => '<controller>/<action>',
),
],
还添加了一个.htaccess文件,
RewriteEngine on
# If a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php
PLZ帮助我,没有这个项目工作正常,但考虑到我在这里添加的其他文件和代码是必要的。我该怎么办呢?
答案
它清楚地说invalidRouteException
。检查你的网址,确保你已经从git正确地将它拉到共享主机。
以上是关于从gitlab运行yii2应用程序将无法正常工作的主要内容,如果未能解决你的问题,请参考以下文章