6

I've just made a Drupal 7 installation on localhost with XAMPP. I created an SQL database and did the installation without any error.

However, when I try to login on Drupal admin from localhost/mytest?q=user, I get an error like "Access denied. You are not authorized to access this page".

I tried to change the password on PhpMyAdmin manually, but I still have this error. I don't have any other drupal installation on my laptop.

These are the latest lines on logs.txt in logs file:

[Thu Mar 05 17:43:11.022491 2015] [mpm_prefork:notice] [pid 4801] AH00169: caught SIGTERM, shutting down
[Thu Mar 05 17:43:15.000852 2015] [ssl:warn] [pid 5867] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Mar 05 17:43:15.001021 2015] [ssl:warn] [pid 5867] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 05 17:43:15.001398 2015] [suexec:notice] [pid 5867] AH01232: suEXEC mechanism enabled (wrapper: /opt/lampp/bin/suexec)
[Thu Mar 05 17:43:15.052113 2015] [auth_digest:notice] [pid 5868] AH01757: generating secret for digest authentication ...
[Thu Mar 05 17:43:16.002626 2015] [ssl:warn] [pid 5868] AH01906: www.example.com:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Thu Mar 05 17:43:16.002750 2015] [ssl:warn] [pid 5868] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Mar 05 17:43:16.003085 2015] [lbmethod_heartbeat:notice] [pid 5868] AH02282: No slotmem from mod_heartmonitor
[Thu Mar 05 17:43:16.015087 2015] [mpm_prefork:notice] [pid 5868] AH00163: Apache/2.4.10 (Unix) OpenSSL/1.0.1j PHP/5.6.3 mod_perl/2.0.8-dev Perl/v5.16.3 configured -- resuming normal operations
[Thu Mar 05 17:43:16.015126 2015] [core:notice] [pid 5868] AH00094: Command line: '/opt/lampp/bin/httpd -E /opt/lampp/logs/error_log -D SSL -D PHP'
sh: 1: -t: not found
  • You get the error when you first access the page or when you send your login/password ? – rtome Mar 5 '15 at 16:00
  • When I send the login..If I am in the home page, I try to login, but there isn't any error. It just doesn't login – Tasos Mar 5 '15 at 16:02
  • Also, I tried to delete and install again the website, but it still show the error – Tasos Mar 5 '15 at 16:02
  • 1
    The weird part is that if I try with a wrong username and pass, I have a message error of Sorry, unrecognized username or password. With the correct username, I don't have it – Tasos Mar 5 '15 at 16:31
  • 1
    If you have drush, try drush uli and load the page with the generated url - you'll need to adjust the base url to localhost – Patrick Ryan Mar 5 '15 at 17:58
1

It may also be a cookie problem. To check if that is what causing it, just try to use another web browser to verify if you get the same problem.

If using that other browser the problem disappaears, then DELETE the cookie in the browser where you experience this problem and try again. Pretty sure your issue will be solved then.

Curious to hear if this helps (sometimes it does ...).

1

I had similar issue.

I tried everything possible to resolve issue

  • checked rewrite enabled
  • AllowOverride All
  • cookie domain in settings.php
  • clear browser cache
  • Truncate Drupal cache*, sessions tables
  • used drush uli user to auto login
  • Changed Drupal Password using drush

Additional Details :

  • Fresh install without any changes.
  • Site was loading without any issue.
  • For incorrect password, Drupal was showing correct message.
  • For Correct username and password no message other than access denied screen.

Problem was related to cookies Then i started search cookies setting in apache conf files.

This was the one setting causing issue for Drupal login, after removing 'Secure' word, i am able to login to Drupal.(Restart apache)

Security: cookies

Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure

TO

Header edit Set-Cookie ^(.*)$ $1;HttpOnly

Look at the Response headers of your site, and check 'secure' is present, it may cause php session issue (on non https)

Set-Cookie: secure; httponly

  • Note : i was using subdomain without https, it was our additional setting for all our server /etc/httpd/conf.d/additional_settings.conf
  • OS : Amazon OS (EC2), Apache : Apache/2.4.33, PHP : 5.6.36
0

Are you sure the site is not installed in a subfolder mytest? Then the login would be localhost/mytest/?q=user (noticed the extra / after mytest)

  • Site is installed here "/opt/lampp/htdocs/mytest"...So, it's not that problem – Tasos Mar 5 '15 at 16:09
0

Check if you have .htaccess file in web-root folder ('/opt/lampp/htdocs/mytest')

Check it your site is in correct folder. 1. Open "/opt/lampp/htdocs/mytest" and create file 'info.php' with content:

<?php echo phpinfo(); ?>

2. Open it in browser: http://localhost/mytest/info.php

Expected result: you should see all php settings. If you don't see them: check path to site's folder.

Enable showing all errors in browser using this doc: https://www.drupal.org/node/1056468

If problem still not solved please provide more information.

0

Apache module mod_rewrite must be on. Otherwise login form wont work...

0

clear your browser cache and then try again with right login credentials.

0

I think the issue can be:

  1. You are not an Administrator of the site. - Check for the Username with Administrator as the role. Then use drush upwd username --password="any_password" from the terminal. And the try logging in with this user name.
  2. Some caching issue - Try clearing the caching from the terminal using drush cc all.
  3. Try clearing all the cookies thats there for your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.