The MU forums have moved to WordPress.org

Help- Cookie Required Error is Killing me! (16 posts)

  1. ht-bob
    Member
    Posted 16 years ago #

    System information

    Ubuntu 7.1
    Apache - 2.2.4
    PHP - 5.2.3-1
    mysql - 5.0.45

    Installing Wordpress-MU V1.3 downloaded today.

    Installation works in that the script files run and tell me the new blog has been installed and give me an admin password.

    When I attempt to login to the admin site I get the infamous "Cookie Required" warning. Refreshing the page doesn't get around the problems as some post suggest.

    I have tried changing the wp-login.php script as suggested by several post here on the blog.

    I have sniffed the login packets and the test_cookie is being sent but it appears that the cookie is expired.

    I have enabled cookies and place my site in the trusted zone in IE and FF. Cookies from the phpmyadmin installation on the same machine are accepted.

    I installed the latest Wordpress installation on the same machine and I am able to log into the Wordpress installation just fine. After logging into Wordpress I verified that a test_cookie was in my FF browser and attempted to log into the Wordpress MU installation. Same error.

    Just for fun I installed the same Wordpress mu files on a Windows server and it works just fine.

    So has anybody resolved this issue? Why does the Wordpress work but the mu doesn't. I diffed the two version of the wp-login.php and other than a call to clear cookies there is no difference in the way the two files generate a check for the test_cookie. They even call the cookie the same thing!

    I find it pretty darn incredible the Wordpress hasn't resolved this issue yet.

    Does anyone know if I install the next older version if that will correct the problem?
    Can anybody tell me why the same Installation of Wordpress_mu runs fine on a windows server? I thought Linux was suppose to be the native environment for Wordpress

  2. andrea_r
    Moderator
    Posted 16 years ago #

    "I find it pretty darn incredible the Wordpress hasn't resolved this issue yet."

    It hasn't been an issue for most people, is why. Wish I could help though. Could be anything on your server.

    And yes, I've recently installed the latest on two different linux boxes and they worked fine.

    Just for giggles, did you try loggin in using different browsers?

  3. JanBrasna
    Member
    Posted 16 years ago #

    Isn't there an issue with the "domain" of the cookie? As "localhost" vs. "localhost.localdomain" etc. ... ?

  4. andrea_r
    Moderator
    Posted 16 years ago #

    the domain issues weren't affecting cookies AFFAIK. but if you are using just "localhost" you're gonna have issues anyway.

    It's supposed to catch that too.

  5. ht-bob
    Member
    Posted 16 years ago #

    I do believe it is a domain of the cookie issue.
    Below is the context of the cookie being sent

    Set-Cookie: TEST_COOKIE=WP+Cookie+check; path=/wpmu/; domain=.seaprodblog03
    Set-Cookie: wordpressuser=+; expires=Tue, 02-Jan-2007 20:11:22 GMT; path=/wpmu/; domain=.seaprodblog03
    Set-Cookie: wordpresspass=+; expires=Tue, 02-Jan-2007 20:11:22 GMT; path=/wpmu/; domain=.seaprodblog03
    Set-Cookie: wordpressuser=+; expires=Tue, 02-Jan-2007 20:11:22 GMT; path=/wpmu/; domain=.seaprodblog03
    Set-Cookie: wordpresspass=+; expires=Tue, 02-Jan-2007 20:11:22 GMT; path=/wpmu/; domain=.seaprodblog03
    Content-Length: 2190
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive

    The domain is being set to the host name and not the domain name.

    This is a linux box getting in a Windows 2003 environment. The DHCP address is being assigned by our cisco routers. The Linux box HAS NOT been binded to the windows domain.
    I have manually set the hostname of the machine to seaprodblog03.htilan.healthtalk.com yet the domain name being passed by wordpress is the hostname?

    Do I need to join this machine to the local domain before it will function?]
    Can I manually set the domain name in the wordpress code?

  6. PhoenixRises
    Member
    Posted 16 years ago #

    By the sounds of it your accessing the site from within the local network? In which case the domain being the host name would kinda make sense.

  7. ht-bob
    Member
    Posted 16 years ago #

    the expired date is one year in the past. Could this be the issue? Host time is set to current time.

  8. PhoenixRises
    Member
    Posted 16 years ago #

    Double check the system time. Being near enough exactly a year in the past makes it sound like its accidentally been set wrong. I'm fairly sure WP/PHP uses system time,but making sure the hardware clock is correct wouldn't hurt either.

    In the end it may not be the problem, but if it is, checking again will save a lot of time.

  9. jpdefillippo
    Member
    Posted 16 years ago #

    One thing I found was causing me problems was

    case 'auth' :
    		$_COOKIE = array(); // Prevent redirect loops caused by corrupted cookies

    I changed it to:

    case 'auth' :
    	if (! is_array($_COOKIE))
    		$_COOKIE = array(); // Prevent redirect loops caused by corrupted cookies

    And the Cookie requires error went away. It was emptying out the already set $_COOKIES array with the test cookies. There was another problem with the cookie domain but that may be a side effect of my main install not being at root level and at a subdomain.

  10. mqrasi
    Member
    Posted 16 years ago #

    hi... i had that problem. I deleted all the files and database...then reinstalled WP-Mu again. It worked. Something happens during installation.

    For instance..i would log in with the prog. generated password right after installation..it would give me cookie error. Then i would ask for a new password... again when i enter that..cookie error.

    Basically --- Delete all.. Reinstall. It will work.

  11. honewatson
    Member
    Posted 16 years ago #

    What I did was simply take the old wp-login.php file from older releases and replaced the new wp-login.php with the old one. I have no idea if this is secure or not but it worked.

    This has been frustrating.

  12. jackiedobson
    Member
    Posted 16 years ago #

    This fix worked for us on the current version out of trac.

  13. ht-bob
    Member
    Posted 16 years ago #

    I FINALLY solved my problem! Thanks to all who have taken to time to suggest and post solutions.

    The problem was when running the Wordpress-mu install script I wasn't putting in the EXACTLY same name as I assigned in Apache. For example because wordpress requires a name.domainname I was inserting blog.machinename in the blog setup but in the apache server setup I was only putting in the blog name. This created a mismatch which caused the client computer to reject the cookie.

    So lesson learned here is that one needs to ensure that the blog name used in configuring wordpress is either the Apache server name or a ServerAlias.

  14. MrBrian
    Member
    Posted 16 years ago #

    Cookies are a very picky, they need to be sent right. In the times it's happened to me, i discovered my problem was related to how i was logging in. I had a login page on my homepage that simply sent POST data to wp-login.php. The problem with this is the setcookie method will not make the cookie become available until the next page refresh, as stated here http://www.php.net/manual/en/function.setcookie.php

    " Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires. Expire time is set via the expire parameter. A nice way to debug the existence of cookies is by simply calling print_r($_COOKIE);."

    Hope that helps someone that might run into it.

  15. awarner20
    Member
    Posted 15 years ago #

    @ ht-bob

    I suspect that my cookie issue may have been caused by what you describe. I had a tough time getting the install to run correctly (first time with cpanel and first time with MU). Anyway, I wonder if you might be able to elaborate a bit on your statement "...learned here is that one needs to ensure that the blog name used in configuring wordpress is either the Apache server name or a ServerAlias."

    Can anyone here help me understand how to check my WP config against my server name? I am using SYN Hosting and Cpanel.

    Any guidance would be very appreciated.

  16. awarner20
    Member
    Posted 15 years ago #

    @ jackiedobson,

    Thanks for pointing me in the right direction on this. I followed a link referenced in that other thread to this solution...

    http://blue-anvil.com/archives/a-wordpress-login-widget-sidebar-login-widget-v10?cp=5#comments

    A simple edit in the wp-login.php file and I appear to be back in action without fear of the cookie monster;)

About this Topic

  • Started 16 years ago by ht-bob
  • Latest reply from awarner20