Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moved my drupal 7 site to a new server, can't log in

I have a very strange problem since I moved my drupal site to a new server.

here's the problem description:

When i try to log in the login page (http://129.16.208.27/drupal/?q=user) just reloads and I can't see my admin panel. If i try to acces an admin page manually i get an access denied message which indicates the login failed. If i type in an incorrect login name or password i get the same behaviour. When trying to request a new password the page just reloads (as above) and i get no email.

This is how i moved the site:

I copied and moved the files, exported and imported the database with phpmyadmin and edited the sessions.php by changeing the base_url and editing the db information.

The site works fine, I can look att all the pages but I just can't log in!

Here's what I've tried:

Deleted the drupal folder and the database and tried again.

Used different methods to change admin password (drush, MD5, in the users table in phpmyadmin).

Changed the permissions of the whole drupal folder to 777.

Commented away the cookie_domain in the settings.php file.

Added drupal_page_footer(); $GLOBALS['tempUser'] = $user; to my index.php file.

Emptied all the tables in the database that starts with cache.

Tried different web browsers and clearing cache.

Here is some more information:

The two servers have the same version of php (5.2.3).

I can log in to the old page with no problem.

The user table in the db looks fine except the acces and login timestamps are old (from before I moved the server).

The watchdog table contain no entries from failed logins but when I try to access http://129.16.208.27/drupal/?q=admin it generates an entry (access denied) but the timestamp is wrong by 1 hour.

The server time is fine.

SpaceBeers asked for the watchdog table, here it is:

===Database orma

== Table structure for table watchdog

|------
|Field|Type|Null|Default
|------
|//**wid**//|int(11)|No|
|uid|int(11)|No|0
|type|varchar(64)|No|
|message|longtext|No|
|variables|longblob|No|
|severity|tinyint(3) |No|0
|link|varchar(255)|Yes|
|location|text|No|
|referer|text|Yes|NULL
|hostname|varchar(128)|No|
|timestamp|int(11)|No|0
== Dumping data for table watchdog

|3344|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/| |83.233.148.7|1331513088
|3345|0|access denied|user/1|N;|4| |http://129.16.208.27/drupal/?q=user/1| |83.233.148.7|1331515605
|3346|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/| |83.233.148.35|1331548875
|3347|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/| |129.16.208.199|1332154845
|3348|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/| |83.233.148.63|1332193286
|3349|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |83.233.148.63|1332195196
|3350|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |83.233.148.63|1332195841
|3351|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |83.233.148.63|1332198728
|3352|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |83.233.148.63|1332200257
|3353|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |83.233.148.63|1332200428
|3354|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |83.233.148.63|1332200431
|3355|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/?q=user| |83.233.148.35|1332322440
|3356|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |76.123.53.220|1332336792
|3357|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/?q=admin| |76.123.53.220|1332336792
|3358|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |76.123.53.220|1332336815
|3359|0|access denied|admin|N;|4| |http://129.16.208.27/drupal/?q=admin| |76.123.53.220|1332337311
|3360|0|page not found|register|N;|4| |http://129.16.208.27/drupal/?q=register| |76.123.53.220|1332337314
|3361|0|access denied|user/register|N;|4| |http://129.16.208.27/drupal/?q=user/register| |76.123.53.220|1332337322
|3362|0|access denied|user/register|N;|4| |http://129.16.208.27/drupal/?q=user/register| |76.123.53.220|1332337354
|3363|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/| |83.248.70.120|1332353203
|3364|0|cron|Cron run completed.|a:0:{}|5| |http://129.16.208.27/drupal/| |130.235.234.145|1332418164
== Table structure for table watchdog

|------
|Field|Type|Null|Default
|------
|//**wid**//|int(11)|No|
|uid|int(11)|No|0
|type|varchar(64)|No|
|message|longtext|No|
|variables|longblob|No|
|severity|tinyint(3) |No|0
|link|varchar(255)|Yes|
|location|text|No|
|referer|text|Yes|NULL
|hostname|varchar(128)|No|
|timestamp|int(11)|No|0

I have spent many hours checking for solutions without success, please help me!

like image 660
vilfra Avatar asked Nov 29 '22 03:11

vilfra


2 Answers

Check your server has rewrite_module enabled

I had the same problem with apache2 on ubuntu server

I ran

sudo a2enmod rewrite

then

sudo /etc/init.d/apache2 restart

and away it went :)

like image 70
Paul Avatar answered Dec 11 '22 03:12

Paul


Have you checked your sites settings.php file?

Make sure it matches your current details AND that the leading . is in place in the line below:

$cookie_domain = '.mydomain.co.uk';
like image 37
SpaceBeers Avatar answered Dec 11 '22 01:12

SpaceBeers