Error on session_start()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Error on session_start()

Post 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.....
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post 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");
?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post 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....
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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.
bigwreck
Forum Newbie
Posts: 2
Joined: Tue Nov 04, 2003 8:01 am

Post 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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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."
RFairey
Forum Commoner
Posts: 52
Joined: Fri Jun 06, 2003 5:23 pm

Post 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?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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.
Post Reply