Friday, October 03, 2008

Gotcha Of The Day - phpShop not being able to log in

Oh, this gotcha hurt. Big time. Here's what happened...

I'm installing phpShop for a customer and all is going well. I deployed the files, setup the database and pretty much got things setup the way I wanted. But, for the life of me, I couldn't log in.

Oh, it would look like it was trying - I'd enter my username and password, but it would take me back to the homee page, still logged out. At first I thought it was cookie issues, but setting:


didn't help my problem. It did, confirm that the session file was getting created, which was a good thing.

I then dropped some code into one of the views to try setting a variable in $_SESSION. Something like:

 echo "Before:";
 $_SESSION['foo'] = isset($_SESSION['foo']) ? 100 : _$SESSION['foo'] + 10;
 echo "After:";

This didn't work as expected, and I thought, Aha! I've found the issue. But, it turns out that phpShop does some wicked things to the session, and it isn't sane to store scalar values in there like I'm trying.

Back to the drawing board. Finally, I hooked the browser up to Fiddler, and realized that my browser was taking an extra hop from:

Then it hit me - oy, I set the variable wrong in config.php. Instead of:


I needed:


One. Lousy. Slash. Argh.

Amazing that progress can be ground to halt because of one missing character.

I added the slash in, and the site worked just like it was supposed to.

No comments:

Post a Comment