Search code examples
phpsessionphp4

I get a blank page until a session cookie is set - PHP 4.4.9


The first time I visit, I get a blank page - no text whotsoever if i click "view source", but a session cookie is added. The second, everything runs as it should. If I delete the cookie, I get a blank page again. Same in all browsers - Firefox 4, IE 9, Chrome 11. PHP 4.4.9

<?php
session_start();
echo "hello";
?>

Update:

Session Support     enabled
Registered save handlers    files user 

session.auto_start  Off Off
session.bug_compat_42   On  On
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  100 100
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   /tmp    /tmp
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off Off
session.use_trans_sid   On  On

This is my phpinfo on sessions I've already tried ini_set("display_errors", 1); I've also tried setting ini_set('error_log') to a file in a folder that is writable, but I don't get any errors (even if I write "asdfasdf(asdf(0)}" as the first line.)


Solution

  • Sounds like an issue with your php.ini

    I would check the "session.save_path" and "session.use_cookies" entries and the directories referenced (permissions etc). Also use phpinfo() to spot configuration errors.