Program Code Errors

idz's Avatar, Join Date: Sep 2007
idz
Go4Expert Member
Hi Shabbir
How are you?
According to your advice,a few days back I purchased this book- "Beginning PHP5,Apache,MySQL Web Development" by E. Naramore,J.Gerner,Stolz,M.Glass,Yann Le(Wrox Publication).
I have installed WAMP5 version(1.7.3).But after running this program code from page 34-35 of the book I get this output in my Firefox browser(latest version)-
Code:
<html>
<head>
<title>My 1st Program</title>
</head>
<body>
<?php
echo "<h1>I'm a lumberjack.</h1>";
echo "<h2>And I'm okay.</h2>";
?>
</body>
</html>
Output:-

I'm a lumberjack."; echo "
And I'm okay.
"; ?>

Why is wrong with the above code? I am getting the 'echo, '; ?' which are part of the syntax of the program, as output!!
Also, the <h1> tag doesn't work!!!Is anything in my configuration wrong?Or is there a error in the above mentioned code?Kindly suggest me what to do to get the correct output..
Also,I have saved the notepad files with .php extension in a folder called "myprog" in the c:\wamp\www\myprog folder.
But when I select the files for running from Firefox browser,it doesn't run.Why i don't know...I have to type http://localhost/programname.php every time I have to run a program in the browser!!
Or,is there a shortcut to the above?When I select File->Open File -> program name the program doesn't run.
I have IIS installed but I have to stop these service manually every time before I start Apache Monitor & wampServer.
Do i also need to start the apache monitor for running PHP?

I am new to PHP programming so please help me...
Thanks in advance

Last edited by shabbir; 8Sep2007 at 18:33.. Reason: Code block
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
I am not sure why you are getting error like that but there is something wrong in your code file that is being executed and the one you have posted it here because I get the things as expected.
0
idz's Avatar, Join Date: Sep 2007
idz
Go4Expert Member
But do i need to run the Apache Monitor everytime for running php programs in browser?
Also,I have IIS installed in my Win XP Pro machine..should i uninstall it?
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
You may have more than one kind of server software installed, just don't have both running at once. I'm not sure what you mean by Apache Monitor. If you want to view the pages you've created in PHP, then you need to have the server running, because that's what interprets the PHP and builds the page.

As Shabbir mentioned, be careful to post your code correctly. Copy and paste it to avoid mistakes.
0
jwshepherd's Avatar, Join Date: Aug 2007
Team Leader
Disabling IIS and setting Apache to auto start will help. Make sure your php.ini file is copied to your windows system32 folder as well.
0
idz's Avatar, Join Date: Sep 2007
idz
Go4Expert Member
But in my PHP Folder I have many php files with various extensions but none exactly with the .ini extension.There is one php configuration settings notepad file,a php Application (CLI) file,
php Application (CGI/Fast CGI) file,php-win(CLI) file,php.ini-dist,php.ini-recommended file and 2 registry files - pws-php5cgi,pws-php5isapi.
...So many files with the name 'php' are there...which one to copy??