I have a PHP script which uses session_start(); which works perfectly on linux server. However, when I try the same script on windows server, I run into permissions problems, presumably on the /tmp directory. I can get round the problem by first creating a 'session' directory just above wwwroot level and then using:
session_save_path('../../session'); // from a sub-directory in the main web, and then:
In the PHP info file, session support is enabled, but session.auto_start is off - could this be the reason?
I found the easiest way is to create a folder called /tmp on the hdd your server uses. eg c:/tmp (change c:/ to your servers' recognised hdd)
Unfortunately, I don't have that kind of access to the server. However, if I first detect whether the server is windows and then, if it is, use my workaround. This seems to be adequate for my purposes. I think I'll leave at that. Thanks anyway.
Good on you for posting the workaround then, its here if someone searches for it.
An alternative is to store sessions in the database using a custom session handler
Regardless of what server you are running on, it is always a good idea to create your own temporary directory for your site (or on a per site bases) this will keep your temp files and session files away from other people/site's temp files and session files. Less chance of mix ups, or premature clean up.
Thanks logic_earth - I think that's good advice.
This topic is now closed. New replies are no longer allowed.