| View previous topic :: View next topic |
| Author |
Message |
ksimmons
Joined: 08 Oct 2006
Posts: 4
|
| Posted: Sun Oct 08, 2006 3:29 pm Post subject: Coding error or bad installation? |
|
|
I'm new to PHP and did a default installation on Windows XP and everything seems to be running.
The book I'm using to learn PHP instructs the reader to use the following code as index.html
Code:
<HTML>
<HEAD>
<TITLE>PHP Testing</TITLE>
</HEAD>
<BODY>
<?php
echo “If this works, we <i>really</i> did it!”;
?>
</BODY>
</HTML>
When I go to localhost in my web browser I get this:
Quote: really did it!”; ?>
Is there an error in the book's text or is this an installation problem?
Thanks. |
|
| Back to top |
|
Vlad Alexa Mancini
Joined: 07 Jul 2003
Posts: 1538
|
| Posted: Mon Oct 09, 2006 7:30 am Post subject: |
|
|
| .html files are not usually parsed with php , and apache2triad setup makes no exception. |
|
| Back to top |
|
ksimmons
Joined: 08 Oct 2006
Posts: 4
|
| Posted: Tue Oct 10, 2006 12:47 am Post subject: |
|
|
Vlad Alexa Mancini wrote: .html files are not usually parsed with php , and apache2triad setup makes no exception.
Well, as I said, I was following directions in a book about PHP
Does your answer mean that the code is correct? |
|
| Back to top |
|
Joshua Meadows (DemoRic)
Joined: 29 Dec 2004
Posts: 785
Location: S.E. Kansas
|
| Posted: Tue Oct 10, 2006 2:45 am Post subject: |
|
|
Quote: Does your answer mean that the code is correct?
Code: <HTML>
<HEAD>
<TITLE>PHP Testing</TITLE>
</HEAD>
<BODY>
<?php
echo "If this works, we <i>really</i> did it!";
?>
</BODY>
</HTML>
Save it with a .php extension and place it in your htdocs folder.
Then access it by
http://localhost/yourFilename.php
You should be pleased with the answer to your question. |
|
| Back to top |
|
ksimmons
Joined: 08 Oct 2006
Posts: 4
|
| Posted: Tue Oct 10, 2006 10:32 am Post subject: |
|
|
Quote: Save it with a .php extension and place it in your htdocs folder.
Then access it by
http://localhost/yourFilename.php
You should be pleased with the answer to your question.
Now I get a blank page. |
|
| Back to top |
|
Joshua Meadows (DemoRic)
Joined: 29 Dec 2004
Posts: 785
Location: S.E. Kansas
|
| Posted: Wed Oct 11, 2006 11:21 pm Post subject: |
|
|
Code: echo "If this works, we <i>really</i> did it!";
Your quotation marks aren't correct. Use that line instead.
Note: it's best to use notepad, or a similiar plain text editor for coding. I like EditPlus http://www.editplus.com/ but there are many out there.
To find out where your error may be see your error logs, or you can enable error reporting.
http://apache2triad.net/forums/viewtopic.php?t=4611&highlight=display+php+errors
touches on it. |
|
| Back to top |
|
ksimmons
Joined: 08 Oct 2006
Posts: 4
|
| Posted: Thu Oct 12, 2006 12:37 am Post subject: |
|
|
Quote: To find out where your error may be see your error logs, or you can enable error reporting.
http://apache2triad.net/forums/viewtopic.php?t=4611&highlight=display+php+errors
touches on it.[/quote]
I get this error:
Quote: PHP Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\apache2triad\htdocs\index.php on line 7
As you can see from my previous messages, I ended line seven with a semicolon |
|
| Back to top |
|
Vlad Alexa Mancini
Joined: 07 Jul 2003
Posts: 1538
|
| Posted: Thu Oct 12, 2006 5:58 pm Post subject: |
|
|
| joshua allready told you about the quotation |
|
| Back to top |
|
| |