Joomla - Cannot login into admin

Recently i faced some serious trouble in joomla to not to be able to login as administrator after moving site from one server to other server. I wasn't showing any error after adding wrong username and password, this was strange to me however i knew this is due to some plugin overriding error behvior.

I tried many fixes and nothing works really for me.

Some of the fixes which i tried was


1)  Editing admin.login.php File located at /administrator/components/com_login/admin.login.php file 

First, i have commented out LoginController::display(); on line 71

This willl enable default login file instead of login component file, this wasn't helped. 

Second, Commented out token request code on line number 58 

JRequest::checkToken('request') or jexit( 'Invalid Token' ); 

This results into i can see error when i add wrong username passsword but adding correct user credentials redirect me back to login page.

I read in few forums that this helped few people, but it wasn't in my case.


2) Checked Sessions are saving correctly in folder or not ? session.save_path checking

i read few people suggested that not able to login into admin may be due to server is not saving session correctly however, i felt that joomla is saving sessing into database. But tried to assign session.save_path directory using ini_set("session.save_path","absolute_path_to_folder"); and give it chmod 777

This wasn't help


3) Edit configuration.php file

Than, i have checked configuration.php file in which i found that logs file path was wrong and was related to old server path, i corrected path for log and tmp directory, however that didn't help me.


var $lifetime = '60';
var $session_handler = 'none';


var $cookie_domain = '';

but no help at all :( 


Finall, what stupid thing worked for me is,

I found file /administrator/includes/defines.php file and at the end of file i have enabled php errors by adding code


somehow my admin worked, i know this solution may not be working for may people but above those checks may work for you and who knows my solution would also work, do write me here for your thought. thanks.