使用 Controller 时 Codeigniter 500 内部服务器错误

标签 codeigniter

我的网站直到几天前都运行良好。它设置在不同的子域中,使用 codeigniter 进行 eclipse 刻。主网站很好并且运行良好,但是当我登录时,admin us 域突然开始显示 500 错误。 我可以通过输入地址来访问它的不同区域,例如

但是当我返回主页http://admin.mysite.com它会抛出 500 错误。

以同样的方式,当我尝试提交要在网站上发布的文章时,也会发生相同的 500 错误。似乎每当我需要使用 Controller 时,它都会生成 500 错误。

我不认为这是 htaccess,它根本没有改变(事实上我已经尝试从备份恢复整个域)并且 500 错误仍然存​​在。

我曾考虑过 apache 问题,但 mod_rewrite 已设置,实际上,由于主域上的站点仍在运行,这使其更加令人费解。

任何人都可以将我推向正确的方向吗?与以往一样,我希望我问的是正确的问题。我连续两天都在尝试解决这个问题,但我却不知所措!

编辑:我终于成功地产生了一个错误:

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to request report data. Error: "GDatainsufficientPermissionsUser does not have sufficient permissions for this profile."' in /var/www/vhosts/dealersupport.co.uk/admin/application/third_party/analytics/gapi.class.php:218 Stack trace: #0 /var/www/vhosts/dealersupport.co.uk/admin/application/modules/analytics/libraries/analytics_lib.php(86): gapi->requestReportData('20924509', Array, Array, Array, NULL, '2011-12-23', '2012-11-23') #1 /var/www/vhosts/dealersupport.co.uk/admin/application/controllers/home.php(34): Analytics_lib->get() #2 [internal function]: Home->index() #3 /var/www/vhosts/dealersupport.co.uk/admin/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array) #4 /var/www/vhosts/dealersupport.co.uk/admin/index.php(202): require_once('/var/www/vhosts...') #5 {main} thrown in /var/www/vhosts/dealersupport.co.uk/admin/application/third_party/analytics/gapi.class.php on line 218

编辑2:还有这个:

Fatal error: Cannot access protected property MY_Form_validation::$CI in /var/www/vhosts/dealersupport.co.uk/admin/application/modules/news/controllers/news.php on line 459

EDIT3:为了完整起见,这里是 htaccess

Options +FollowSymLinks +SymLinksIfOwnerMatch RewriteEngine On

Options -MultiViews

Prevent access via browsers to all htaccess files. order allow,deny deny from all

RewriteEngine On

# Shortcut globally accessible design locations, to hide true location # of these files from users. RewriteRule ^(css|js|images)/(.*)$ application/assets/$1/$2 [L] RewriteRule ^modules/([a-z_]+)/(css|js|images)/(.*)$ application/modules/$1/assets/$2/$3 [L]

# 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
RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule>

# 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>

# Turn off ETags, to improve performance.
Header unset ETag FileETag None

Prevent directory listing. Options -Indexes

最佳答案

也许这不是同一个问题,但我过去在某些 Controller 的 CI 中遇到过一些错误 500,因为 PHP Controller 文件的编码以某种方式损坏了。

唯一的解决方案是重新创建 Controller (新的 PHP 文件,复制代码...)。

关于使用 Controller 时 Codeigniter 500 内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13524617/

相关文章:

php - 在 codeigniter 中取消设置一些 session 数据

php - 代码点火器 $this->db->reconnect();用法

php - 使用自定义 htaccess mod 重写时有效路由上的 Codeigniter 404

javascript - 如何使用ajax创建目录并在其中上传文件?

php - 如何设置用户角色和权限?

php - 存储 php ://input in a variable 的内容

php - 使用 session 变量的 CodeIgniter 表单验证

javascript - 如何在ajax post中接收ajax回调

mysql - Codeigniter dbforge 库 - 将 db 用户分配给当前数据库并添加授予权限

Codeigniter - 如何获取值作为数组以用于下一次使用 where_not_in 选择