ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

PHP error on Control Panel homepage

June 20, 2013 3:30pm

Subscribe [5]
  • #1 / Jun 20, 2013 3:30pm

    charlesgallant

    2 posts

    Hi guys,

    There seems to be a grizzly looking PHP error on my Control Panel’s login page (myDomain.com/admin.php):

    Fatal error: Call to a member function send_ajax_response() on a non-object in /Users/charlesgallant/ ...path to my site… /stem/expressionengine/core/EE_Exceptions.php on line 62

    (I’m testing locally via MAMP, and I’ve renamed my system folder “stem”. This happens on my server as well).

    Based on some digging, EE_Exceptions.php is returning NULL for the following expression:

    $EE =& get_instance(); //<-- [system folder]/core/EE_Exceptions.php, line 51

    After checking permissions, disabling plugins, etc. I found something surprising (and very frustrating):

    Visiting myDomain.com/admin.php?S=0&D=cp&C=login works fine, while visiting myDomain.com/admin.php (with no query parameters) throws the above fatal PHP error.

    How is this possible!? Either way, there are links in the CP that point to /admin.php, which means this bug is effecting my Members, so unfortunately I can’t accept this workaround.

    Additional background:
    - Latest version of EE (as of today, 2.6.1)
    - PHP 5.3.20 (and have tested 5.4.10), Apache
    - I’ve disabled third party additions, and checked permissions
    - I’ve followed the Post-Install Best Practices guide
    - Everything else on the site appears to work fine.

    Any thoughts on how to fix this would be greatly appreciated.

    Thanks in advance,
      C

  • #2 / Jun 21, 2013 1:59pm

    Sy Andersohn

    8 posts

    I’m having the same problem after uploading it to the live site, even though the dev site is working fine.

    I am accessing the website via proxy which seems to be part of the problem. I have have developed sites on the same server behind proxy with previous versions of EE no problem. So I assume it’s something to so the the latest EE.

    charlesgallant, are you also accsing your site via proxy?

    The full message I get is:

    A PHP Error was encountered
    Severity: Notice
    Message: Use of undefined constant AJAX_REQUEST - assumed 'AJAX_REQUEST'
    
    Filename: core/EE_Exceptions.php
    Line Number: 60
    A PHP Error was encountered
    Severity: Notice
    Message: Trying to get property of non-object
    Filename: core/EE_Exceptions.php
    Line Number: 62
    
    Fatal error: Call to a member function send_ajax_response() on a non-object in /home/mywebsite/system/expressionengine/core/EE_Exceptions.php on line 62

    I had a dig around and it seems that the when it’s behind a proxy the router it tries to incorreclty load
    /home/mywebsite/system/expressionengine/controllers/cp.php
    rather than
    /home/mywebsite/system/expressionengine/controllers/cp/login.php

    I found this within CodeIgniter.php where $RTR->fetch_class() is used to load the login file, but I’m not sure where to look from there to find the source of the problem.

    So where we have &D=cp&C=login in the url it would force it to use them to the load the file correctly, without it it seems to go wrong.

    - EE Version 2.6.1
    - PHP Version 5.3.24

    Any help appreciated

    Many thanks
    Sy

  • #3 / Jun 21, 2013 3:05pm

    Sy Andersohn

    8 posts

    Looking further into this is seems that even the EE Controller does not get loaded. I found a quick fix for this by adding this to your .htaccess:

    RewriteCond %{QUERY_STRING} ^$
      RewriteRule ^admin.php$ /admin.php?S=0&D=cp&C=login [R=301,L]

    I hope this helps, but I t hink that should work for now.
    Sy

  • #4 / Jun 21, 2013 3:39pm

    Sy Andersohn

    8 posts

    Update: unfortunately it appears that this only works so far, where I am not able to edit any entries because some addons don’t get loaded.

    Any ideas would be much appreciated.

    Thanks
    Sy

  • #5 / Jun 21, 2013 4:05pm

    charlesgallant

    2 posts

    No proxy server on my end. I’ve also noticed that the little control panel’s “session timeout” notification/login form appears to be broken. In other words, the small form that appears in the header of the control panel after an interval of inactivity no longer functions.

  • #6 / Jun 23, 2013 9:38am

    Sy Andersohn

    8 posts

    I’ve also noticed that the little control panel’s “session timeout” notification/login form appears to be broken. In other words, the small form that appears in the header of the control panel after an interval of inactivity no longer functions.

    Interesting! I hadn’t noticed this before but also found that this doesn’t work with my 2.6.1 installs. This is where it displays but I am unable to login successfully.

    With the CP login problem, I found that it is something to do with the way that the URI is handled. I think it may be handled via the CI router but never gets passed to the new EE controller??

    The problem stems from where under a proxy the $_SERVER[‘REQUEST_URI’] outputs the full url rather than the actual uri part. I created a hacky fix for this in one of the core Codeigniter files as follows:

    File: system/codeigniter/system/core/URI.php
    Line: 149
    Added: fix for $uri variable where $_SERVER[‘REQUEST_URI’] gets the full url when behind proxy

    if(stripos($_SERVER['REQUEST_URI'], "http") === 0) {
     $parts = parse_url($_SERVER['REQUEST_URI']);
     $uri = $parts['path'];
     if(isset($parts['query'])) {
      $uri .= "?" . $parts['query'];
     }
    }

    A less hacky way could be done by altering the actual $_SERVER[‘REQUEST_URI’]  variable within the root admin.php, but this works for me.

    Perhaps you could echo the $_SERVER[‘REQUEST_URI’] and see if you get the full url too, which could explain your problem…

    Cheers
    Sy

  • #7 / Jun 23, 2013 8:49pm

    charlesgallant

    2 posts

    Thanks for the suggestion, sy, but both of those approaches aren’t getting rid of the error on my end… perhaps because I’m not using a proxy server :\

    In fact, as far as I can tell there’s really nothing terribly unique about my install.

    If anyone has any insights, they would be greatly appreciated.

  • #8 / Aug 07, 2013 2:52pm

    Michael Swanson

    32 posts

    I ran into a very similar issue trying to use Reinos’ gmaps fieldtype plugin.  He suggested logging in via /system/index.php which fixed the issue.  The problem is that in my prod environments /system is above the web root following the best practices for security.  So I am not sure how to address it there other than moving the /system dir back into the web root.

  • #9 / Aug 14, 2013 7:46am

    Maik Hoogkamer

    36 posts

    Running into this error as well when accessing a MSM site’s /admin.php directly.
    I want my client to login to a single site, having it turned off individually in the backend.

    The error I get:

    A PHP Error was encountered
    
    Severity: Notice
    
    Message: Use of undefined constant AJAX_REQUEST - assumed 'AJAX_REQUEST'
    
    Filename: core/EE_Exceptions.php
    
    Line Number: 60
    A PHP Error was encountered
    
    Severity: Notice
    
    Message: Trying to get property of non-object
    
    Filename: core/EE_Exceptions.php
    
    Line Number: 62
    
    Fatal error: Call to a member function send_ajax_response() on a non-object in /home/users/pripkftp/printerlease.nl/system/expressionengine/core/EE_Exceptions.php on line 62

    Running v2.6.1 - Build Date: 20130506 with the latest MSM. Accessing via /admin.php?S=0&D=cp&C=login seems to make the login screen appear though.

    All in all pretty annoying, spent some hours already trying to get my head around this.

  • #10 / Sep 05, 2013 4:06pm

    lealea

    202 posts

    Just want to make sure in case anyone’s subscribed to this thread that the bug report related to this has a fix that worked for me:
    https://support.ellislab.com/bugs/detail/19630

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases