I had a perfectly functional GoDaddy website (under development) before Christmas break. It has not been changed. Today, I logged on and I have all these strange errors regarding sessions that weren’t there before.
To investigate, I made a new file and threw it on the site with the contents:
<?PHP
session_start();
echo "HELLO WORLD!";
?>
Navigating to this page in a freshly opened browser gives the following output:
Warning: session_start() [function.session-start]: open(/var/chroot/home/content/05/8547705/tmp/sess_m3uikb1qe6v5hsjir8ilsfa811, O_RDWR) failed: Permission denied (13) in /home/content/05/8547705/html/try.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/05/8547705/html/try.php:2) in /home/content/05/8547705/html/try.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/05/8547705/html/try.php:2) in /home/content/05/8547705/html/try.php on line 2
HELLO WORLD!
Warning: Unknown: open(/var/chroot/home/content/05/8547705/tmp/sess_m3uikb1qe6v5hsjir8ilsfa811, 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 () in Unknown on line 0
I don’t even know where to start with this – does anyone know what could have changed to make this basic file not work?
Haven’t seen the first warning, but the others happen if the script sends headers or data before the call to session_start(). You can fix that by either:
1) making sure that there’s no HTML or whitespace before session_start(), or,
2) using output buffering (see ob_start() and ob_end_flush().
With (2) you can start the session anytime during script execution; the buffering makes sure headers and response data are sent to the browser in the right order.