I'm having a problem with sessions. I have included 2 code examples that display the problem I am having in the most simple way possible. These are not the actual files I am running but they give the exact same problem.
The first file test.php:
Code: Select all
<?php
session_start();
header("Location: testresult.cgi");
?>Code: Select all
#!/usr/bin/php
<?php
session_start();
echo "Hello it worked!";
?>Warning: session_start(): open(/tmp/sess_c5ef8a7dca7d280681a5ad2411753c2a, O_RDWR) failed: Permission denied (13) in /home/friendsh/public_html/dev/testresult.cgi on line 3
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/friendsh/public_html/dev/testresult.cgi:3) in /home/friendsh/public_html/dev/testresult.cgi on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/friendsh/public_html/dev/testresult.cgi:3) in /home/friendsh/public_html/dev/testresult.cgi on line 3
Hello it worked!
Warning: Unknown(): open(/tmp/sess_c5ef8a7dca7d280681a5ad2411753c2a, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
But if I run the second file testresult.cgi directly I do not get this error at all and the file runs as it should. It seems to be a problem with the header location redirect.
Has anyone got any ideas how I can prevent this problem?
Cheers
Keith