symfony 1.4 Login Won’t Work

I ran into a strange problem last night while working on a site I built in symfony 1.4. I couldn’t login from my macbook pro using firefox for the browser. I was getting in fine from my iMac using firefox and safari. And I could get in on my macbook pro if I used safari, but trying to login from firefox was taking me right back to the login page.

It wasn’t giving me an error, just going back to the login screen. It appeared to be returning a 401 error in firebug. It was logging me in because my code checking for authentication was passing, but it wouldn’t let me into the protected module without kicking me back to the login screen.

I cleared the cache in firefox. I even reinstalled firefox, but still no dice. It would not let me in no matter what I tried.

I tried running the dev.php file so that I could see errors. The only errors I got were the ‘headers sent’ message that I often get when leaving debug statements in the code. After a check of the code, I didn’t find any print statements or any of my normal debug statements. I was baffled.

After a good night of sleep, a good walk and my general morning routines, I hit it again. I found it! I had a space before the opening php tag in my action file. This was the action file that the login was redirecting me to after a succesful login.

Since I searched Google for something that would help and didn’t find anything on this topic, I thought I would post this in hopes that it will help someone else with the same kind of problem.

This entry was posted in on technical stuff and tagged , , , , , . Bookmark the permalink.

2 Responses to symfony 1.4 Login Won’t Work

  1. Kuba says:

    It’s a known problem in PHP. If you have anything after the PHP closing tag (‘?>’) you might get this error. It’s about PHP and not symfony.

    I usually skip PHP closing tag in files with PHP code only. It’s a common and valid practice.

  2. Cindy says:

    Kuba,

    I leave out the closing tags too. The space was before the opening php tag (‘< ?’). I understand this is a php problem but it was hard to track down since there were no errors :)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>