Page 1 of 1

Problems running php.

Posted: Tue Jul 01, 2003 5:41 am
by dave_c00
I am new to php and i am having difficulty in getting any coding to work. When i use variables the page just says;

Notice: Undefined variable: testing in c:\inetpub\wwwroot\testing.php on line 10

Notice: Undefined variable: testing in c:\inetpub\wwwroot\testing.php on line 11

but then displays the correct info. Can anyone help? Is it to do with apache?

Thanks

Dave

Posted: Tue Jul 01, 2003 5:52 am
by twigletmac
Could we see lines 10 and 11 of the code?

Mac

The whole code that i used.

Posted: Tue Jul 01, 2003 6:14 am
by dave_c00

Code: Select all

<html>

<head>
<title>(Type a title for your page here)</title>

</head>

<body>
<?php
$testing;
print gettype($testing);
print "<br>";
$testing = 5;
print gettype($testing);
print "<br>";
$testing = "five";
print gettype($testing);
print ("<br>");
$testing = 5.0;
print gettype($testing);
print ("<br>");
$testing = true;
print gettype($testing);
print "<br>";
?>

</body>

</html>
?>

Posted: Tue Jul 01, 2003 6:22 am
by twigletmac
It's because on these lines:

Code: Select all

$testing; 
print gettype($testing);
you are trying to access a variable which has not been set - $testing does not exist. You then subsequently set $testing to a number of different variables so it works then.

Mac

To answer your question about Apache...

Posted: Tue Jul 01, 2003 2:07 pm
by tal3323
In my experience it has been much better to run PHP with Apache, but that's only through my own experience. I ran an IIS webserver on Windows 2000 and two different Windows XP boxes. In both cases I ran into picky problems with the installation whether I used the PHP executable or the PHP zip file. The Apache installation was very smooth, and not complicated at all. All you need to do is add three lines to the httpd.conf file. You can find support for installing PHP with Apache at http://www.php.net.

Again this is all based on my own experience and opinion. I find Apache more stable, more secure, and easier to run with PHP than IIS.