elmas156 Posted February 24, 2011 Share Posted February 24, 2011 I'm using WampServer to test php pages locally. I just started having this warning message show up: Warning: session_start() [function.session-start]: open(c:/wamp/tmp\sess_3c3f4g0dhb6qu007v167pv1u45, O_RDWR) failed: Permission denied (13) in C:\wamp\www\page_include\index.inc.php on line 2 The warning shows up and I am directed to the login page. The funny thing is, when I refresh the browser, the warning goes away and the page is directed to the page the user is directed to after they are signed in. I haven't changed any of my code since everything was working fine. Is this a problem with WampServer or possibly something that I should be looking at changing my code to fix? Any suggestions? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 24, 2011 Share Posted February 24, 2011 The session file is probably already open due to one piece of your code and another piece of code attempts to open the same session file. Any chance your page is using a captcha image where the main page and the code for the dynamically generated captcha image are both executing a session_start() or you are using Ajax and the code that the Ajax is requesting is using a session_start along with the main page? Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1178972 Share on other sites More sharing options...
elmas156 Posted February 24, 2011 Author Share Posted February 24, 2011 No, none of that. In fact, I only have session_start(); on one file, which is included in the pages that are only accessible to signed in users, along with my database sign in information and a few other variables that remain the same during the session. I do, however use the following if statement to display certain information if the user is signed in: if (isset($_SESSION['logged']) && $_SESSION['logged'] == 1) { show this } else { show this } This is used on a couple of files that are included on every page. Other than this, the session is not mentioned any where else on any of the pages. Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1178975 Share on other sites More sharing options...
elmas156 Posted February 24, 2011 Author Share Posted February 24, 2011 Am I correct to put session_start at the top of every page that the user will view while signed in? That is what I've been doing, and, like I said, this warning just suddenly started showing up, and it's only an occasional warning, I can even click the browser back button and re-click the same link and it will go to the appropriate page rather than show the warning message again. It's very odd. Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1178982 Share on other sites More sharing options...
PFMaBiSmAd Posted February 24, 2011 Share Posted February 24, 2011 I'm going to guess that your browser is requesting the page twice (this usually happens due to a debugging add-in in your browser) and it occasionally occurs fast enough that the second request is being serviced before the first request has completed and released the session data file. You need a session_start() statement on any page the sets or references a $_SESSION variable. Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1179043 Share on other sites More sharing options...
elmas156 Posted February 24, 2011 Author Share Posted February 24, 2011 Great, as long as I know that it's not likely a problem with my code. As always, thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1179137 Share on other sites More sharing options...
PFMaBiSmAd Posted February 24, 2011 Share Posted February 24, 2011 So, do you happen to have a debugging add-on installed in your browser and if so, when you disabled it, did the problem still occur? If this is being triggered by double-requests from your browser, it could also be an indication that your page is doing something extremely inefficient and is taking a long time on the server to produce the page. Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1179168 Share on other sites More sharing options...
elmas156 Posted February 24, 2011 Author Share Posted February 24, 2011 Well, I'm using Firefox 4, which is a beta version. I think it had something to do with the browser because it's not happening at all now, even if I try to make it happen. I don't think it ever happened in IE either. As far as inefficiency, I don't think that is the case. What I am doing now that I know a little more about php and how it works, I'm re-doing my entire site with the intention of making it more efficient by cleaning up my code. I've removed a lot of un-needed code and it does seem to respond faster as well. I'll see how things go and if the problem re-occurs. Thank! Quote Link to comment https://forums.phpfreaks.com/topic/228666-wierd-warning-that-corrects-itself-i-think/#findComment-1179177 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.