Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display a php file in broswer

Status
Not open for further replies.

james0816

Programmer
Jan 9, 2003
295
US
I'm just messing around with PHP trying to learn it better. I created just a basic file named test.php and saved it at the root of C: (C:\test.php)

code:
<?
echo "HI";
?>

How do I get it to display in my IE browser?

every time I try to put the file name in it wants me to open or save the file.

I run PHP on my machine so I know its not a browser issue per se. Just curious.
 
Hi

The PHP file is a script. The proper HTML document is not the script, but its output. The script must be executed to produce its output.

You need a web server set to execute the PHP script and send its output to the browser.

Feherke.
 
ahhhhh....so if one is just messing around trying to learn php then it should all go in the inetpub/ folder.

gotcha...thx
 
Hi

If you want to learn PHP, you can do it without web server & browser. PHP script can be executed from command line too.

You can execute scripts from a file :
Code:
[blue]your prompt >[/blue] more james0816.php
<?php
for ( $i=0; $i<10; $i++ ) echo "OK", $i%2 ? "\n" : "\t" ;
?>

[blue]your prompt >[/blue] php james0816.php
OK      OK
OK      OK
OK      OK
OK      OK
OK      OK
Or code entered as parameter :
Code:
[blue]your prompt >[/blue] php -r "echo strtoupper(str_repeat(hello,3));"
HELLOHELLOHELLO
Of course this later is usefull only on Unix or Unix-like operating systems.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top