Pradeep Jaiswar Pradeep Jaiswar - 1 year ago 46
PHP Question

magento not able to login in admin panel

I am new to magento. When i try to login in admin panel it gives me below error. It works when i off my session auto start off. But doing this my other application don't work on server. I am using magento 1.9 version. To add i am running nginx not apache

Fatal error: Mage_Admin_Model_Observer::actionPreDispatchAdmin(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Mage_Admin_Model_User" of the object you are trying to operate on was loaded before unserialize() gets called or provide a __autoload() function to load the class definition in /var/www/html/magento/magento/app/code/core/Mage/Admin/Model/Observer.php on line 62

Answer Source

Ok, so for your information, ngnix is not parsing htaccess at all and Magento heavily rely on htaccess for security.

Before even considering your problem, please know that, if your server have anything else than a local access, you are at risk, because, as you can see in the app/etc/local.xml file, accessible to everyone, you are giving the world your database access.

Please have a complete reading of this document : http://info.magento.com/rs/magentocommerce/images/MagentoECG-PoweringMagentowithNgnixandPHP-FPM.pdf where you can find a basic ngnix configuration for Magento :

server {
    listen 80 default;
    server_name magento.lan www.magento.lan; # like ServerName in Apache
    root /var/www/magento; # document root, path to directory with files
    index index.html index.php;
    autoindex off; # we don’t want users to see files in directories
   location ~ (^/(app/\|includes/\|lib/\|/pkginfo/\|var/\|report/config.
xml)\|/\.svn/\|/\.git/\|/.hta.+) {
    deny all; #ensure sensitive files are not accessible
 }
location / {
    try_files $uri $uri/ /index.php?$args; # make index.php handle requests for
/
    access_log off; # do not log access to static files
    expires max; # cache static files aggressively
 }
location \~\* \.(jpeg\|jpg\|gif\|png\|css\|js\|ico\|swf)$ {
    try_files $uri $uri/ @proxy; # look for static files in root directory and
   ask backend if not successful
    expires max;
    access_log off;
 }
location @proxy {
    fastcgi_pass fpm_backend; # proxy everything from this location to backend
 }
location \~\.php$ {
    try_files $uri =404; # if reference to php executable is invalid return 404
    expires off; # no need to cache php executable files
    fastcgi_read_timeout 600;
    fastcgi_pass fpm_backend; # proxy all requests for dynamic content to
    # backend configured in upstream.conf
    fastcgi_keep_conn on; # use persistent connects to backend
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root${fastcgi_script_name};
    fastcgi_param MAGE_RUN_CODE default; # Store code is defined in
   #administration > Configuration > Manage Stores
    fastcgi_param MAGE_RUN_TYPE store;
   } 
}

Then, when and only when you have an access denied on the file app/etc/local.xml, please consider adding ngnix tag to your question, then an user with more ngnix knowledge can maybe help you further than me (since it is more a sysadmin job than a "coder" like me job).

All I can say is : it looks like if you add fastcgi_param PHP_VALUE "session.auto_start=0"; under the section

location \~\.php$ {
    fastcgi_param PHP_VALUE "session.auto_start=0"; 
    #... more come here but I'm shortening just for the specific problem
}

That should do the trick.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download