PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri Oct 06, 2006 3:41 pm
In IE I don't see anything
That's because I'm still unable to put a valid </title> in the code, grmpf.
Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
session_start();
?>
<html>
<head>
<title>session test</title>
</head>
<body>
<p><?php echo 'time: ', date('H:i:s'); ?></p>
<p><?php echo 'id:', session_id(); ?></p>
<p><?php echo 'name:', session_name(); ?></p>
<p><?php echo 'use_cookie: ', ini_get('session.use_cookies'); ?></p>
<p><?php echo 'use_only_cookie: ', ini_get('session.use_only_cookies'); ?></p>
<p><?php echo 'session.use_trans_sid: ', ini_get('session.use_trans_sid'); ?></p>
<pre><?php print_r($_COOKIE); ?></p>
<div><a href="<?php echo $_SERVER['PHP_SELF']; ?>">reload</a></div>
</body>
</html>
Array
(
)
There should have been a cookie PHPSESSID, but there isn't. The browser does not send any cookies back to the webserver. Therefore php does not know anything about a previously started php session
Stephen Bungert
Forum Commoner
Posts: 25 Joined: Sat Feb 25, 2006 3:22 am
Post
by Stephen Bungert » Fri Oct 06, 2006 3:53 pm
But I can save and make cookies with PHP. I've used them before.
And my browser accepts cookies too.
Should I re-install PHP and Apache?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri Oct 06, 2006 3:54 pm
What does the "latest" version of the script -including error_reporting, ini_set- print?
Again reload the script several times using the link.
Stephen Bungert
Forum Commoner
Posts: 25 Joined: Sat Feb 25, 2006 3:22 am
Post
by Stephen Bungert » Fri Oct 06, 2006 3:58 pm
In IE I see the following:
time: 22:57:59
id:2tu7e6hctbkos9ur43dmiu07k6
name:PHPSESSID
use_cookie: 1
use_only_cookie: 0
session.use_trans_sid: 0
Array
(
)
reload
Firefox displays the same too.
The only thing that seems to change is the session id
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri Oct 06, 2006 4:01 pm
hm, still no cookie.
Let's try to set one manually.
Code: Select all
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
// this should appear in _COOKIE after a reload
setcookie('mycookie', date('H:i:s'));
session_start();
?>
<html>
<head>
<title>session test</title>
</head>
<body>
<p><?php echo 'time: ', date('H:i:s'); ?></p>
<p><?php echo 'id:', session_id(); ?></p>
<p><?php echo 'name:', session_name(); ?></p>
<p><?php echo 'use_cookie: ', ini_get('session.use_cookies'); ?></p>
<p><?php echo 'use_only_cookie: ', ini_get('session.use_only_cookies'); ?></p>
<p><?php echo 'session.use_trans_sid: ', ini_get('session.use_trans_sid'); ?></p>
<pre><?php print_r($_COOKIE); ?></p>
<div><a href="<?php echo $_SERVER['PHP_SELF']; ?>">reload</a></div>
</body>
</html>
Stephen Bungert
Forum Commoner
Posts: 25 Joined: Sat Feb 25, 2006 3:22 am
Post
by Stephen Bungert » Fri Oct 06, 2006 4:05 pm
time: 23:04:58
id:ak2s2n5sgg03gb5ufr4q462351
name:PHPSESSID
use_cookie: 1
use_only_cookie: 0
session.use_trans_sid: 0
Array
(
[mycookie] => 23:04:58
)
reload
Again only session id changes (and the time and cookie time)
Stephen Bungert
Forum Commoner
Posts: 25 Joined: Sat Feb 25, 2006 3:22 am
Post
by Stephen Bungert » Fri Oct 06, 2006 4:11 pm
OK, thanks all for your help... pain in the arse to reinstall but I guess I must.
Thanks all again. I shall post back if re-installing helped.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Fri Oct 06, 2006 4:12 pm
installing xampp only takes a minute.
Stephen Bungert
Forum Commoner
Posts: 25 Joined: Sat Feb 25, 2006 3:22 am
Post
by Stephen Bungert » Sat Oct 07, 2006 2:27 am
I have it installed now xampp, but I can't find the apache config file there is none. I need to have it set up the way it was before (I still have the old config file. Where the old config file used to be (in the apache directory under xampp) there is only the default config file example. Where's the actuall config file being used by apache?
Stephen Bungert
Forum Commoner
Posts: 25 Joined: Sat Feb 25, 2006 3:22 am
Post
by Stephen Bungert » Sat Oct 07, 2006 4:29 am
Found it.
Also sessions now working with xampp installed
Thanks all for your help