codeigniter session doesn't start depending on the server, XAMPP vs. Amazon Apache EC2? |
[eluser]tim peterson[/eluser]
Hi all, I know this question makes no sense but I'm hoping that by talking it out perhaps someone can give me a clue as to where to start to look. I've got a Codeigniter application on my XAMPP localhost and the production version of it an Apache Amazon EC2 server. The issue is that I can't log in to my app on my localhost but I can on the Amazon server. I previously had it working on both servers but one day I changed something on my localhost, which now I can't figure out what it is, and now it only works on the Amazon server. I copy and pasted the entire app from the Amazon EC2 /var/www folder to my XAMPP htdocs folder but this didn't resolve the issue. I'm using codeigniter sessions class but this hasn't changed so I just wanted to make that clear. Is there something in the XAMPP configuration that I need to be thinking of? I thought codeigniter sessions were stored in the client so I thought server wouldn't matter. thanks, tim
[eluser]CroNiX[/eluser]
Check all of the cookie settings, especially "cookie_domain". Use firebug or something to see if the cookies are getting properly set. Are you on a mac by chance? One thing that took me awhile to troubleshoot was on an older project that used ion_auth, which uses crypt() when saving and checking the passwords for login. The crypt that comes with a mac is different and not compatible with any other version if it uses MD5, apparently. So if your passwords were stored in a db using crypt() other than on a mac, you won't be able to read them ON your mac. Brilliant, Apple. Just google "mac php crypt" and you will see lots of problems caused by this.
[eluser]tim peterson[/eluser]
Hi Cronix, I am on a mac, thanks for the tips, I do have firebug/firecookie but I'm not sure what you mean by "cookie_domain", can you explain where I'd find that? thanks, tim
[eluser]CroNiX[/eluser]
In CI, in /application/config/config.php, there is a setting for cookie domain. The cookie will only be valid/readable for whatever domain is listed there. So, if its set for "myserver.com" and you are trying to run it on your "localhost", you won't be able to read the cookies because they are only readable by "myserver.com".
[eluser]tim peterson[/eluser]
hmm, ok found that. it was set to: Code: $config['cookie_domain'] = ""; i've never knowingly changed that so not sure this is the issue i just changed it to: Code: $config['cookie_domain'] = "http://localhost"; but that made no difference, any other thoughts? thanks, tim
[eluser]CroNiX[/eluser]
Trace the code when you are logging in to find out exactly where the error occurs... Are you using a stepping debugger? If you use git or other version control software you can just revert back a few commits until it works again and then run a diff on the versions to see what changed.
[eluser]tim peterson[/eluser]
hi CroNIX, i'm not using a stepping debugger, can you advise on how to go about that? Is this a good place to start? http://state68.com/content/simple-step-t...nd-macgdbp I was not using git or SVN on my localhost unfortunately. thanks, tim
[eluser]CroNiX[/eluser]
That could work. I use Zend Studio which is built on Eclipse (available for mac, Eclipse is free) and they both have it built in. It's one of the handiest features to have in an IDE. Stepping through the code, watching the variable values change, seeing all of the datatypes and arrays in realtime, etc. It's invaluable for many things.
[eluser]tim peterson[/eluser]
Ok, i've got Zend Studio installed, I've never used this or Eclipse. can you give me a sense of how to run the controller function for my login form (the <form action="/process_login"></form>) such that I can examine it for errors? thanks, tim
[eluser]CroNiX[/eluser]
Well, there are many things to set up (the first time) and you kind of have to be fairly familiar with zend studio. It would take awhile to explain. There are tutorials on debugging using zend/eclipse. Check on youtube, google, etc. |
Welcome Guest, Not a member yet? Register Sign In |