1

I just installed a new drupal 7.39 using drush. From the browser, I can only goes as far as the front page(welcome page) and no further. I cannot log-in, suggesting that drupal is not accessing the database. The installation went smoothly. Below is my drush commands. Anything wrong with it?

$ drush site-install standard --db-url="mysql://root@localhost/mydrupal1" --site-name=MyDrupal1 --account-name=my_username --account-pass=my_password
1
  • Could be an issue with clean urls. Try running drush vset clean_url 0 --yes
    – Ollie
    Sep 1, 2015 at 10:55

4 Answers 4

4

Check if you get the same problem using another browser. If with another browser it works, then it might be a cookie problem, The remedy in that case is to delete the cookie in the browser where you have the problem, and try again. Otherwise read on for other typical reasons (options) ...

Option 1 - RewriteRule and RewriteBase

Check if you can use an URL containing ?q=user or ?q=admin. Refer to my answer to the question "7.26 /admin, /user not found on Localhost" (which is about RewriteRule) for more details on that.

In that answer there is a link to the question about "drupal /?q=user is working but /user not working", for which the accepted answer of that question provides more details about tuning RewriteBase in your .htaccess.

Option 2 - Admin option 'Clean URLs'

I you can use the ?q=adminURL, then try to navigate to /index.php?q=admin/config/search/clean-urls to check the current status of clean urls (if it is enabled or disabled). Make sure "clean urls" is enabled.

Refer to "Clean URL leads to duplicate URL after migration to another hosting" for more details on that.

Option 3 - base_url

Make sure the value of "base_url" is set correctly (in your settings.php).

Option 4 - .htaccess file

Verify if the .htaccess file is present in the directory where Drupal resides (and/or that it is not incomplete or corrupt). If it is missing, then upload it. If needed copy it again from the "Drupal" archive file (.zip or .tar) from Drupal.org again, and just use that new .htaccess file.

2

In addition to the suggestions made by Pierre, you should also check the value of $cookie_domain in your settings.php file. If this is set incorrectly (e.g. to mylivesitedomain.com when you are accessing your site via localhost), then you will be unable to log in. Drupal will log you in correctly (presuming you entered the correct username and password), but the login cookie will not be sent back by your browser, so the login will not "stick".

Also, to reinforce what Pierre said about $base_url -- if this is not set correctly, the symptoms will be very similar. For example, if you log in to your site via localhost, it is common for your local web server to report 127.0.0.1 instead. Again, your login cookie will not be attached to the right domain, and you will not be logged in. In this instance, setting $base_url to localhost is the right answer. I like to do this:

$base_url = str_replace('127.0.0.1', 'localhost', $base_url);

That way, the port in $base_url will match whatever I happen to use when running the site via drush runserver.

1

My answer may sound too simple, but I had the similar problem after fresh install. What helped was deleting all cookies in Firefox. After that I could login.

0

I figured out the solution: I just realized that the rewrite_module on WAMP Server was not enabled(My WAMP Server too is a new install. And Drupal uses this module via .htaccess for url resolution), so I simply enabled it. Problem solved.

My thinking is that with rewrite_module disabled(default), the drupal site couldn't move beyond front page (which is default page) because it couldn't resolve any further urls requested, including urls that access the database.

Thanks for your attention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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