【发布时间】:2014-12-18 04:51:00
【问题描述】:
我们在 yii2 中构建了一个项目。它在本地服务器上运行良好。但它不适用于共享服务器。我在 htaccess 中尝试了很多,但仍然无法为我工作。它给了我 500 内部服务器错误
前端 htaccess :
RewriteEngine on
# 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
后端 htaccess
RewriteEngine on
# 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
我该如何解决这个问题?
【问题讨论】:
-
第一步是检查日志以了解返回 500 错误的原因。第二步是确保您拥有的权限对于所有者和组是正确的。最后一步是 die();在您的代码期间,直到您找出导致 500 ISE 的原因。
-
即使 PHP 版本略有不同,最终也会引发 500 个异常。日志是你的朋友。
-
我无法查看日志。因为我没有这方面的凭据。这是共享服务器,我正在使用 FTP。
-
通常它们会在您可以访问的地方。如果他们不允许您访问您的 apache 日志,请更改您的主机,因为它们可以为每个用户单独保存。
标签: php shared-hosting yii2