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
Problems running php.
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
The whole code that i used.
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>
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
It's because on these lines:
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
Code: Select all
$testing;
print gettype($testing);Mac
To answer your question about Apache...
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.
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.