PCHomepage
Programmer
I have a little diagnostics script that fetches server, session and cookie info and it works well on my live server. It also worked well on my development system until I switched recently to Linux (Ubuntu 8.10) where the line that gives the session values generates an error.
The actual error is "Invalid argument supplied for foreach()." Any ideas?
Code:
<html>
<head>
</head>
<body>
<?php
$s = "<h4>Server Values</h4>";
foreach($_SERVER as $key=>$value)
$s = $s . "<b>" . $key . "</b> = " . $value . "<br>";
$s = $s . "<p><h4>Session Values</h4>";
[COLOR=red]foreach($_SESSION as $key=>$value)[/color]
$s = $s . "<b>" . $key . "</b> = " . $value . "<br>";
$s = $s . "<p><h4>Cookie Values</h4>";
foreach($_COOKIE as $key=>$value)
$s = $s . "<b>" . $key . "</b> = " . $value . "<br>";
$s = $s . "<p><h4>GD Support</h4>";
foreach(gd_info() as $key=>$value)
$s = $s . "<b>" . $key . "</b> = " . $value . "<br>";
//$s = $s . "<p><h4>PHP Details</h4>";
//foreach(phpinfo() as $key=>$value)
//$s = $s . "<b>" . $key . "</b> = " . $value . "<br>";
echo $s;
?>
</body>
</html>
The actual error is "Invalid argument supplied for foreach()." Any ideas?