Page 1 of 1

Error on session_start()

Posted: Mon Nov 03, 2003 3:53 am
by RFairey
All of a sudden I get this error on two of my sites when the line session_start(); is executed. It only happens in Mozilla Firebird, and it only happens occaisionally. There are other errors, but I think they are the usual 'Cannot send header' that get caused by the first error being output.


Warning: open(/tmp/sess_e08e8735faff7d341bf2eb3d2124210d, O_RDWR) failed: Permission denied (13) in <my webroot>/loginscript.php on line 36

What's going on? It's all worked fine up till now.....

Posted: Mon Nov 03, 2003 4:32 am
by itsmani1
'Cannot send header'
to over come the issue

just use

but u hav to use in the start of the page i.e on the 1st line

Code: Select all

<?php
ob_start("mb_output_handler");
?>

Posted: Mon Nov 03, 2003 5:06 am
by twigletmac
itsmani1 - you have to be sure of the question before you answer. In this case it is not that there is a headers already sent error, but that permission is being denied when PHP attempts to write to the session file. Please take care to read questions carefully.

RFairey - I've not come across this myself but it seems strange that you would be denied permission sometimes and only when using a specific browser :? . Have you searched for any relevant bugs on php.net (bugs.php.net)?

Mac

Posted: Tue Nov 04, 2003 3:46 am
by RFairey
Hmmm - its now happened to me in IE as well, albeit on a different computer. On this one (the one where firebird plays up,) IE has worked fine as have Opera and Netscape. The problem is still intermittent - I'll get onto the sysadmins who host it all and see what they have to say....

Posted: Tue Nov 04, 2003 11:45 am
by JAM
If the script causing this (well, the script being run upon error shows) isn't to long, could you post it or put up the source on a public access server?

As it works sometimes, I hardly think there is an error in the script, but to get the bigger picture it could be nice.

Bump up the error levels, erase @function so that you do not supress error msg's that might appear before the one you posted in the original post. Meaning, if you supress the error from function A(), but A() is vital for function B()... well, it's like a house of cards.

Posted: Tue Nov 04, 2003 12:28 pm
by bigwreck
are your permissions set properly ? Is this running on windows ? UNIX ? it looks like you dont have permissions to write to /tmp ... if this is running on windows you'll have to change your php.ini file to reflect this ie C:\temp or whatever

Posted: Tue Nov 04, 2003 1:13 pm
by Gen-ik
bigwreck wrote:are your permissions set properly ? Is this running on windows ? UNIX ? it looks like you dont have permissions to write to /tmp ... if this is running on windows you'll have to change your php.ini file to reflect this ie C:\temp or whatever
To qoute twigletmac "You have to be sure of the question before you answer. In this case it is not that there is a headers already sent error, but that permission is being denied when PHP attempts to write to the session file. Please take care to read questions [EDIT: and replies] carefully."

Posted: Tue Nov 04, 2003 6:19 pm
by RFairey
Ah - I think I know whats happening - what happens if I do a session_start on one site, then hit another session start on another site before calling session_destroy on the first one? Thats what I reckon is happening (both sites are on the same server). Is there a way to ensure no other session is in progress before starting a new one?

Posted: Tue Nov 04, 2003 6:30 pm
by Gen-ik
To be honest I don't think that would be the problem (unless your server is really screwed up). Every user that visits your website will start a new session and each session gets a unique ID as you probably know. You will have your own session data when you browse this Forum for example, and if you open up another Browser window and go to another site the chances are you will start a session there as well.

It might be worth looking into it just to make sure but as I said I doubt that's the problem.... I certainly haven't had any trouble with multi-sessions on my home server.