Reputation: 161
I am a beginner in PHP.
I am receiving the following errors. I cannot view the error from my computer on FF, IE, and Chrome, but yet I see the error up top when browsing from another computer's browser.
Warning: session_start() [function.session-start]: open(/tmp/sess_c464nadk4jsn4u43mpqipkjbr7, O_RDWR) failed: Permission denied (13) in "file location" on line X
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at "file location":line X) in "file location" on line X
Any ideas anyone?
I have the session_start() before the includes which means before any html, and the session is only used to carry over one variable.
I tried placing it before
Header("Cache-control: private, no-cache");
Header("Pragma: no-cache");
but this only generated more Warning signs. Any help would be appreciated!
Upvotes: 0
Views: 2913
Reputation: 1972
The first error seems to indicate missing write permission in the temp directory but could be linked to the second one also.
The second error normally only happens when there is some kind of output is being sent from your php script before the session_start()
call, because will automatically send HTTP headers. This can be any kind of html or even blank lines or spaces in the file before the actual call or before the <?php
opening bracket. As Shane suggests in a comment, the reason for the second error could very well be that the error message from the first error (unable to write the session to a file in /tmp) causes headers to be sent and thus it is too late to send them with the header()
call.
Upvotes: 0
Reputation:
The "headers already sent" error is caused by the first one. The other answers here trying to debug it aren't going to help you. Fix the first error and the second will go away. The first error tells you what your problem is already - the /tmp directory is not writable by the web server. /tmp is usually 777 (rwxrwxrwx).
Upvotes: 1
Reputation: 24271
<?php
starting tag?session_start()
really the first statement within the php block?Upvotes: 1
Reputation: 2049
seems that the /tmp/ dir is not readable or writable by the user php is running as.
Upvotes: 4