I have a problem with session in combination with DNS.
I use have a webpage where some areas are restricted. So I use a log-in screen which sets the session username and writes the sessionid in a DB. When you try to access a restricted page, a script checks if you are logged in with the current session. This works fine when I run the site localhost. It still works when I use a remote computer and type in the IP-address of the server. But the server also has a name and when I typ in this name you can still log-in, but when you try to access a restricted page, I says I'm not logged in. (the other pages still work)
I've traced the problem to the session, because when you start the page with the IP it writes 2 files in /var/lib/php/session , but if I use the DNS it writes a new file for every click... So why is the session restarted when I call the page with DNS, but not when I use localhost or IP ?
I use Fedora with PHP 5.2.2
Directive => Local Value => Master Value session.auto_start => Off => Off session.bug_compat_42 => Off => Off 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_httponly => Off => Off 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 => 1000 => 1000 session.gc_maxlifetime => 1440 => 1440 session.gc_probability => 1 => 1 session.hash_bits_per_character => 5 => 5 session.hash_function => 0 => 0 session.name => PHPSESSID => PHPSESSID session.referer_check => no value => no value session.save_handler => files => files session.save_path => /var/lib/php/session => /var/lib/php/session session.serialize_handler => php => php session.use_cookies => On => On session.use_only_cookies => Off => Off session.use_trans_sid => 0 => 0
PHP is not my native language....
Edited 5 Years Ago by Nick Evan: n/a