当前位置: 动力学知识库 > 问答 > 编程问答 >

Codeigniter 500 internal server error when using controller

问题描述:

I have a site that until a few days ago was working perfectly. It's setup in different sub domains, etching using codeigniter. The main website is fine and working well, however the admin us domain has all of a sudden begun to display 500 errors when I login.

I can access the different areas of it by typing the address eg

However when I return to the main page http://admin.mysite.com it kicks out a 500 error.

In the same way when I try to submit an article to be published on the site the same 500 error occurs. It seems that whenever I need to use a controller it generates a 500 error.

I don't think it's the htaccess, it hasn't changed at all (indeed I've tried to restore the whole domain from backups) and the 500 error persists.

I've toyed with the idea of an apache problem but mod_rewrite is set, indeed as the site on the main domain is still functioning this makes it even more puzzling.

Can anyone push me in the right direction. As ever with these things I hope I'm asking the right questions. I have been trying to fix this for two days straight and I'm at a loss!

EDIT: I have managed to produce an error finally:

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

EDIT 2: And this:

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: and for the sake of completeness here is the 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

网友答案:

Maybe it's not the same issue, but I had in the past some error 500 in CI for some controllers because the encoding of the PHP controller files was somehow corrupted.

The only solution was recreating the controller (new PHP file, copy the code ...).

网友答案:

I had the same problem today and i resolved it by changing in .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

Note:

RewriteBase / was important for me.

分享给朋友:
您可能感兴趣的文章:
随机阅读: