Jump to content

Archived

This topic is now archived and is closed to further replies.

Meistro

Absolute Beginners Question

Recommended Posts

Hey, I am currently reading Wrox, beginning PHP5. Apache and MySQL Web Development. Their first PHP example program is :


<html>
<head>
<title> My First PHP Program</title>
</head>
<body>
<?php
echo "I'm a lumberjack.";
?>
</body>
</html>

when I run this in FireFox and I.E. It doesn't say any text in the body, just gives me the title. Is this something to do with PHP not being installed configured properly? Help! I am lost : )

To recap :
I wrote this in notepad, saved it to my desktop, opened it in IE and Firefox and got the title but nothing was said in the main box.

BTW what does everyone think of the book I am reading, any good? Are there other, better, absolute newbie guides?

Thank you

Share this post


Link to post
Share on other sites
I'll assume you saved the file with a .php extension ...

php files are parsed on a server then sent to a browser to be rendered. In simple terms, the php script is executed on the server to generate an html file which will then display in a browser.

So, two choices: #1 is upload the file to a server to test and the preferred option would be to have a server installed as localhost (your computer). If you already have that then you can view your work by browsing to [a href=\"http://localhost/yourfiles/test.php\" target=\"_blank\"]http://localhost/yourfiles/test.php[/a] for example. If you haven't installed a server on your local machine you'll need to. My personal one-click install favorite (works on all flavours of Windows) is phpdev5 from [a href=\"http://www.firepages.com.au\" target=\"_blank\"]http://www.firepages.com.au[/a], which includes php, MySQL, phpMyAdmin, and Apache - everything you need.

Share this post


Link to post
Share on other sites
[!--quoteo(post=369946:date=Apr 29 2006, 03:34 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 29 2006, 03:34 PM) [snapback]369946[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I'll assume you saved the file with a .php extension ...

php files are parsed on a server then sent to a browser to be rendered. In simple terms, the php script is executed on the server to generate an html file which will then display in a browser.

So, two choices: #1 is upload the file to a server to test and the preferred option would be to have a server installed as localhost (your computer). If you already have that then you can view your work by browsing to [a href=\"http://localhost/yourfiles/test.php\" target=\"_blank\"]http://localhost/yourfiles/test.php[/a] for example. If you haven't installed a server on your local machine you'll need to. My personal one-click install favorite (works on all flavours of Windows) is phpdev5 from [a href=\"http://www.firepages.com.au\" target=\"_blank\"]http://www.firepages.com.au[/a], which includes php, MySQL, phpMyAdmin, and Apache - everything you need.
[/quote]


Thank you, I truly appreciate you taking the time to help me with what is likely a simple answer. I did install using 'foxserv' but have not changed any of the settings.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.