Running:
Microsoft SBS 2003 w/ IIS 6.0
PHP 5.21 ISAPI
An ecommerce site I had running at a web host on some incarnation of PHP4 has now been moved to my own in-house web server. Both were running IIS, but I am on 6 and they were on 5 something. Also, PHP changed from 4 to 5.21. My problem is, sessions sometimes work but mostly don't. Nothing that is repeatable. I have been scouring the net for weeks and have everything set up right. PHP is installed in C:\php, and the "Network Service" account has read/execute access to it. Sessions are in C:\php\sessions and everything is configured right in php.ini. "Network Service" has full control of the sessions folder. All the ISAPI extensions, web services, etc.. are set up properly in IIS. Basically, everything works perfectly when the session decides to work.
Let me go into that a little deeper. A session cookie is always created for the browser whenever there isn't one detected. I can look at it in my browsers cache and find it in the C:\php\sessions folder. So sessions are actually created the right way. The problem is, when I add something to my shopping cart it most of the time refreshes the page and the cart still says it is empty. If I clear my browsers cache, delete everything from the C:\php\sessions folder on the server, then most of the time I can get everything to work...things add to the cart beautifully. If a person completes an order all the way through to the checkout process however, when they are dumped back into the site with a freshly emptied cart, it will never work. Not for them nor most others visiting the site.
I use all $_SESSION vars not the old $HTTP_SESSION_VARS variables..I had to convert all those a long time ago. I have already tried playing with php.ini until I am exhausted...just to get it to work, I have turned on globals, etc.. I also have @session_start() on every page.
I am leaning towards blaming this on some garbage collection or some bad relationship between PHP 5.21 and IIS 6.0. I have trouble blaming my code since it has worked for many years and still works sometimes now. When code is bad it is usually predicatbly bad whereas this seems like a container issue instead because of its unpredictability.
I am at the end of my rope! 🙂 Any help would be appreciated...