Hi everybody hope someone could help me.
i moved a drupal site to another server to work on.

Site can connect correctly to database, base_url and cookie_domain are set to the right root.

in .htaccess there was a RedirectMatch variable set to the old urls and i edit it to the new ones.

i try to login as administrator and failed.

I disallowed by database clean url, but when i try to login by "?q=user" , after submitting ID and PW it gives me "access denied" error.

I run update.php and try to clean the cache, watchdog say nothing about my attempts, i cleaned all rows in session table by database.

When i try to login, it redirect me to the user 1 profile (as it should)
?q=users/1
but it doesn't log me, so i receive the access denied page.

I tried also to reset the password, but when i confirm the one-time link access, it show me again the access denied page.

Someone have any suggestion?
Many thanks
Alberto

Comments

vm’s picture

clear db cache tables
clear session table
clear browser cache and cookies
test

tiikeri’s picture

Many thanks for quick reply VM,
i tried this way before, but cleaning drupal cache.

Now, for being sure and don't make loose time to you (as to other drupal users), i cleaned the cache and cache_* tables by database, cleaned the session too, and cleaned browser cache and persistent cache.
But still can't fix the problem.

I checked the Rewritebase and uncommented it as another attempt, but not working.

In a first time i thought it could be a problem with path, but path seems correct in settings.php and .htaccess. Also, as i wrote in the first post, it seems redirecting to user/1 is correct.
It should be file's permission settings? maybe need to rebuild them?

tiikeri’s picture

i checked the error_log file founding this:
(I changed database name and www folder with MYDATABASE and FOLDER)

[27-Feb-2013 06:57:30 America/New_York] PHP Warning: Table 'MYDATABASE.access' doesn't exist
query: SELECT 1 FROM access WHERE type = 'host' AND LOWER('2.233.3.222') LIKE LOWER(mask) AND status = 0 LIMIT 0, 1 in /home/tiikerid/public_html/FOLDER/includes/database.mysql.inc on line 135
[27-Feb-2013 06:57:30 America/New_York] PHP Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/tiikerid/public_html/FOLDER/includes/database.mysql.inc:135) in /home/tiikerid/public_html/FOLDER/includes/bootstrap.inc on line 1165
[27-Feb-2013 06:57:30 America/New_York] PHP Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/tiikerid/public_html/FOLDER/includes/database.mysql.inc:135) in /home/tiikerid/public_html/FOLDER/includes/bootstrap.inc on line 1165
[27-Feb-2013 06:57:30 America/New_York] PHP Warning: Table 'MYDATABASE.cache' doesn't exist
query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'variables' in /home/tiikerid/public_html/FOLDER/includes/database.mysql.inc on line 135

LINE 135 of database.mysql.inc refer to drupal_error_handler
while bootstrap error refers to:

function drupal_is_denied($type, $mask) {
  // Because this function is called for every page request, both cached
  // and non-cached pages, we tried to optimize it as much as possible.
  // We deny access if the only matching records in the {access} table have
  // status 0 (deny). If any have status 1 (allow), or if there are no
  // matching records, we allow access.
  $sql = "SELECT 1 FROM {access} WHERE type = '%s' AND LOWER('%s') LIKE LOWER(mask) AND status = %d";
  return db_result(db_query_range($sql, $type, $mask, 0, 0, 1)) && !db_result(db_query_range($sql, $type, $mask, 1, 0, 1));
}

any suggestion?
it should be related to user 0?

Thank you

vm’s picture

have you verified that the table in question is in the DB?

tiikeri’s picture

Thank u again Kenn ;)
"access" table exist in db, there is just one IP address recorded (i verified the IP, it is a spambot blocked)

vm’s picture

If there a prefix set on your database? either by you or by the host that isn't set in settings.php?

tiikeri’s picture

No prefix is set for database tables name.
While host use a prefix, but i added it in settings.php

also hostname should be localhost, but i can try to put the ip address if this might be the issue.

Anyway, site working fine, so i suppose site is connecting with db.

if it can help, cause of large size of database, i had to export it by mysqldumper, and imported it by bigdump (mysql format utf-8 encoding)

tiikeri’s picture

I checked chace table too, it is in db.

tiikeri’s picture

Wow, i descovered that in some template files there are variable from PHP4, such as

<?php
import_request_variables('gPc');
$PHP_SELF = $_SERVER["PHP_SELF"];
$pagina_corrente =$_SERVER['REQUEST_URI'];
//echo $pagina_corrente;
if (ereg("nbsp",$pagina_corrente))
{
$pagina_corrente = ereg_replace("nbsp","-",$pagina_corrente);
//echo $pagina_corrente;
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: $pagina_corrente");
}
?>

i tried to disable the theme, but when i try to login i'm redirect to
/home?destination=home

seems there are many problems on this site, that's way i prefer the drupal way in customizing things...
At this point i dunno if i'm off topic or if i was right in requesting support to drupal community...

gpc variable is not supported on php5.3, so i had to downgrade the php version of my localhost to make me login ;)

beautifulmind’s picture

How did you migrate your site to new server? Did you just migrated everything and edited settings.php? The correct way to migrate is to do a clean install and then import the db!

Regards.

Regards.
🪷 Beautifulmind

tiikeri’s picture

thank you for your reply, i will take in consideration your suggestion for next time, but i'm not sure this was the case, because that site have lots of contributed module (more of them unnecessary). I'm not the author of the site, i try to limit hacking in core (if necessary i use override techniques in theme).

The problem was exactly what i descovered: the PHP4 variable written in all of the themes files caused the error. I had to switch my sistem to php5.2.17 (the lowest version i was able to download) in which "import_request_variables('gPc');" is deprecated but still working.

Then i figured it was better to re-build the site in drupal7, following the drupal theming guidelines instead of cleaning all the errors of that site

regards! ;-)