Page 1 of 1

Help with displaying PHP

Posted: Tue Oct 09, 2007 4:26 pm
by rrrrr1235
Hi,

I have installed the AppServ. I have typed the following into a textfile:

<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>


and then I changed the fileanme and extension to helloworld.php.

I tried to pull it to Internet explorer, i have the following displayed:

Name: helloworld.php
Type: Unknown File Type, 68 bytes
From: C:\Documents and Settings\R\Desktop

Open Save Cancel



And then when I click Open, nothing happens, I was supposed to be seeing Hello World on the browser right?

When I right click the file and click Properties, I have:

Type of file: PHP File
Opens with: Internet Explorer


I am not sure what's wrong, help me please.

Posted: Tue Oct 09, 2007 7:29 pm
by califdon
What's wrong is that you are trying to use PHP, which is a server script, without a server. Your browser can render HTML and run Javascript code, which is client script, but knows nothing about PHP. PHP is interpreted by a web server like Apache or IIS (Microsoft), before anything is sent to the browser. So PHP creates HTML and Javascript for the browser, it never sends raw PHP to the browser (at least not intentionally). Thus, your browser does not recognize a .php extension.