PHP Doesn't Execute

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP Doesn't Execute

Postby jimmyham » 02. January 2008 20:02

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
Jimmy Ham
jimmyham
 
Posts: 4
Joined: 02. January 2008 19:48

Postby sari42 » 02. January 2008 20:34

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.
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby KallistaAEnvarou » 02. January 2008 22:37

Does <? phpinfo() ?>work?
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

PHP Doesn't Execute

Postby jimmyham » 03. January 2008 19:13

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.
Jimmy Ham
jimmyham
 
Posts: 4
Joined: 02. January 2008 19:48

Postby KallistaAEnvarou » 04. January 2008 11:20

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.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests