You are here: Sessions not Working on WAMP « PHP Programming Language « IT news, forums, messages
Sessions not Working on WAMP

Posted by PulsarSL on 10/17/83 11:35

Hey

I have a WAMP setup (windows/apache/mysql/php). I'm running the latest
version of all of them with a default installation of all of them. PHP
works great with apache (as a module, not cgi), except that sessions
aren't working. The script at the bottom of this post never increments
my hit count. Do I need to turn sessions on somehow in php.ini?

Thanks,

PulsarSL



----

Works great on a remote web server I have, so it's not the script...

----

<?php
// Initialize a session. This call either creates
// a new session or re-establishes an existing one.
session_start( );

// If this is a new session, then the variable
// $count will not be registered
if (!session_is_registered("count"))
{
session_register("count");
session_register("start");

$count = 0;
$start = time( );
}
else
{
$count++;
}

$sessionId = session_id( );

?>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd" >
<html>
<head><title>Sessions</title></head>
<body>
<p>This page points at a session
(<?=$sessionId?>)
<br>count = <?=$count?>.
<br>start = <?=$start?>.
<p>This session has lasted
<?php
$duration = time( ) - $start;
echo "$duration";
?>
seconds.
</body>
</html>

----

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация