Page 1 of 1

PHP Doesn't Execute

PostPosted: 02. January 2008 20:02
by jimmyham
Hi all,

I am new to all this.

I installed Apache/PHPO and MYSQL using XAMPP. I can get the phpinfo page up OK but when I run this file:

<html>
<head>
<title>hekko world</title>
</head>
<body>
<?php
echo "hello world!<br />";
print "goodbye<br />";
print "over and out<br />";
?>
<p> this should appear after th php bit </p>
</body>
</html>

I see "hekko world" as the page title and "this should appear after th php bit" on the page, nothing more.

What have I not done that I should have done.

Ta

PostPosted: 02. January 2008 20:34
by sari42
your code works well when saved as test.php
and called like http://localhost/test.php

maybe you are trying to invoke it out of dreamweaver or some such?
Don't do that.

PostPosted: 02. January 2008 22:37
by KallistaAEnvarou
Does <? phpinfo() ?>work?

PHP Doesn't Execute

PostPosted: 03. January 2008 19:13
by jimmyham
Hi Guys,

Thanks for the help. My error was simply twofold:

Firstly, I forgot to save the file as .php, rather than .html
Secondly, I tried to execute the file from a project folder, IE (7) seemd to think it was a download! Eventually I realised that the file has to be in the same folder as phpinfo (or presumably a child folder will do). I placed the file there. Bingo! Success! Now I can start blundering around MYSQL and design the odd (cery) form.

Ta.

PostPosted: 04. January 2008 11:20
by KallistaAEnvarou
That's why view: source helps. :)

I'm glad everything has worked out.

On a side note, you simply just need to put the file in the htdocs folder or a subdirectory for it to work.