【发布时间】:2018-01-30 20:46:29
【问题描述】:
我在 Heroku 中尝试启动暂存 Codeigniter 3.x 项目时遇到 500 错误(这是第一次)。我似乎找不到比这更好的日志了。
我正在使用 heroku-php-apache2 buildpack。 PHP版本是5.6.x
但是,通过调试我可以看到它正确设置了根目录为public_html,它正在加载根目录中的index.php,它正在加载config.php和database.php,它正在加载路由.php。
在我的 routes.php 中,我有: $route['default_controller'] = "家";
当我转到主页时,我得到一个 500 错误,它没有像预期的那样加载 home/index 控制器方法。当我引用一个 css 文件(例如 https://staging-app/css/grid.css)时,它会加载该文件,因此我知道目录正在被正确访问。
如果需要,我的 .htaccess 是
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} !business-loan-tips.*
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
虽然,不管有没有它,它似乎加载相同。
我的 composer.json 是空的,除了 '{}'
而我的 Procfile 只是:
web: vendor/bin/heroku-php-apache2 public_html/
关于我可能会出错以得到 500 错误或如何更好地跟踪它的任何想法?
编辑: 我确实正确地访问了数据库。我只是无法让我的控制器击中。
【问题讨论】:
标签: php codeigniter heroku http-status-code-500