By mixersoft on
I posted this in another thread, but I think it deserves it's own.
I can access drupal fine over 'localhost', but have no success using the host ipaddr (i.e. 192.168.0.2), both using a port number
http://localhost:8080/sitename => works fine.
http://192.169.0.2:8080/sitename => does not work.
I checked the cookies in FF, and I can see multiple PHPSESSID cookies created for the 'localhost' session, but
NO COOKIES ARE CREATED for the sessions from http://192.168.0.2:8080/sitename
Not even for the anonymous user. Why would drupal be unable to write cookies to the ipaddr session? Does the port no play a role with this?
How do I debug this?
Comments
another clarification
btw, when I say it doesn't work, I mean that drupal works fine, but I am stuck as an anonymous user with no session id.
I have a similar log-in problem with my live site hosted at site5. In that case, the following happens:
with php4 enabled:
I can write PHPSESSID's for both anonymous sessions and successful logins
with php5 enabled:
I can write PHPSESSID for just the anonymous session. When I try to login, I do not get an updated PHPSESSID cookie, like I do with the php4 example. as a result, login fails. However, if I switch to php5 after I have a valid PHPSESSID from a php4 login, then everything works fine.
Any idea why this is happening? My browser is FF, but the problem also occurs with IE7
If you have the latest
If you have the latest Drupal 5 release there is a line near the end of your settings.php file:
#ini_set('session.cookie_domain', '.example.com');Try this: Remove the front # and change it to
ini_set('session.cookie_domain', '.192.168.0.2');You are a Genius!
many thanks, that did the trick.
BTW, the cookie domain fix below doesn't fix the site5 php5 prob
Unfortuanlely, I still have 1 outstanding problem.
With site5 set to php5, I can write an anonymous PHPSESSID cookies to the right domain, but I never get a new PHPSESSID cookie via a successful login.
Somehow, php4 and php5 processing of logins are different in my config, and php5 get stuck before they write the session cookie. Any ideas?
Another bug fix available
And, now (I think) you are hitting another bug: Login issues with mutiple sites in the same domain (session cookie collision). Boy, you must be having a fun night. ;-)
If I understand your problem correctly, my patch should fix that, too.
- John
Albin.Net : friendly web development
- John (JohnAlbin)
Bug fix now available
This is due to this bug in Drupal. http://drupal.org/node/131017
Basically, the settings.php file is specifying the cookie_domain, but you can't specify an IP in the "domain" field of a cookie. So your browser is rejecting the cookie.
If you know how to apply patches, please try the patch I added to the above bug report and post a “follow up” on that issue on whether it worked for you or not.
- John
Albin.Net : friendly web development
- John (JohnAlbin)
Why patches?
If you know how to apply patches or are willing to learn, it would go a long way to making Drupal better if you reported your success/failure of the patches on those bug reports.
But since applying patches is too complicated for many people, here’s a bit of a hack that will do almost the same thing as the 2 patches I mentioned before:
Change sites/default/settings.php from:
to:
The use of
conf_init()inside the settings.php file is the hackish bit. But, it will work as long as you do NOT set$confthe “Variable overrides” part of settings.php.- John
Albin.Net : friendly web development
- John (JohnAlbin)
The conf_init() hack works for the ipaddr bug, but not the php5
I haven't tried the patch yet, but I can confirm that the cookie collision hack from above resolves my problem with PHPSESSIDs that have ipaddrs for cookies domains. hardcoding $domain to an ipaddr also resolved this problem.
However, both those fixes don't help with my site5 hosted drupal login problem - php4 works/php5 doesn't. Looking at the FF cookies, I think the php5 code path exits after the PHPSESSID is first created for an anonymous user, but before the login PHPSESSID is written, since it never changes on login.
still open to suggestions.
How exactly is your live
How exactly is your live site set up?
Do you access it as example.com or as www.example.com or as a subdomain or in a subdirectory?
Is your settings.php in /sites/default or in /sites/example.com or in /sites/www.example.com?
Does settings.php contain a $base_url or is it commented out?
Have you made any domain-specific changes in .htaccess?
I am asking because from what I have read so far this is just a site hosted at site5 -- it should just work.
Site5 config
I tried it 2 way, both exhibit the same behavior.
1) a standard config installed by fantastico at http://www.domain.com, and
2) my current dev config, which is in a subdirectory, but NOT a sub-domain, so http://www.domain.com/devconfig
- also, settings.php is in sites/default
- have tried without and with the baseurl set, currently it is set.
- /public_html/.htaccess has just 1 line that I use to toggle between php4/5: #AddHandler application/x-httpd-php5 .php
That's what I know, but I've been fiddling with this bug for awhile and I may have changed something else without remembering. Does anyone else have this php4/5 login bug, or am I just nuts? Should I just blow everything away and try again from scratch?
Occasionally someone has
Occasionally someone has problems with one php version or another, but as I said, generally it should just work with either php version.
Fantastico is a bad idea most of the time. Their versions are usually older and they use their own modified installation scripts for which it is difficult to find help here. (Can't be sure what they do).
So, you have Drupal installed in public_html/devconfig, your site is http://www.domain.com/devconfig, and you have also put that in $base_url in your sites/default/settings.php.
What about public_html/devconfig/.htaccess? (Drupal's default .htaccess) Is it there, unmodified?
Are you using clean URLs? (if so, try without clean URLs to see whether the problem is still there).
Also, in Drupal's .htaccess there is a line
#RewriteBase /drupal. Try uncommenting it and changing it toRewriteBase /devconfigI'll try anything once
John,
The problem I am experiencing is described here (please see link). I think it is the same on described on this thread. I tried your patch and it didn't help, although it did log me out. Once I logged in in again (which I did without a problem), I was still unable to open the affected nodes.
I am willing to try any other suggestions, and would appreciate any advice you might offer.
Many thanks for your time.
Tom
--
tomrue.net
FIXED! Here is the answer...
I found a site5 server that was working properly and had them compare configs. This is what they found.
The mod_bandwidth module was automatically installed on the server recently and it was assigned a wrong priority, which was causing POST variables not to be passed to the PHP5 CGI wrapper.
once they made the change, problem with php5 was solved.
this also solves similar problem with localhost installations
had the same problem with 2 "productivity tools" that I had installed on my pc, so this also works for 2 or more sites on your localhost.
-----------------
Check out our blog on http://www.pronovix.com/blog
FIXED! Here is the answer...
I found a site5 server that was working properly and had them compare configs. This is what they found.
The mod_bandwidth module was automatically installed on the server recently and it was assigned a wrong priority, which was causing POST variables not to be passed to the PHP5 CGI wrapper.
once they made the change, problem with php5 was solved.
The answer doesn't seem to work for me...
Mixersoft,
I'm having this same issue, and I don't believe tat I have mod_bw installed. I am running my own FreeBSD 6.1 server on Apache 1.3.24, PHP 5.1.2 mod_perl/1.29, MySql 5.0.18, with a combination of Drupal 4.6.6.6 and 5.11 sites.
The site I'm having trouble with at the moment is monticello.hopto.org, which is running Drupal 5.11, where I am unable to open the Menu Admin or or User Access pages.
Oddly, another Drupal 5.11 site, on the same PHP 5.1.2 server (ellarue.com), which has the same modules installed experiences no such problem.
Tom
--
tomrue.net
Similar Problem with NAT
I have experienced a similar problem with drupal 5.1 and php 5.2 on a debian etch. I have installed it on a server with a private address, accessed from the outside world by means of a NAT on a firewall. When accessing my drupal installation from the private lan (http://192.168.1.102/drupal) server sent a cookie to my browser and I was able to login. When accessing from the outside world (http://neptune.mydomain.it:8080/neptune) server didn't send any cookie and I was not able to login. I have found that deleting this lines in settings.php
if (isset($_SERVER['HTTP_HOST'])) {
$domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
// Per RFC 2109, cookie domains must contain at least one dot other than the
// first. For hosts such as 'localhost', we don't set a cookie domain.
if (count(explode('.', $domain)) > 2) {
ini_set('session.cookie_domain', $domain);
}
}
fix the problem. Now I can login from the inside lan and from the outside world. No sure if this has any side-effect.