File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes PHP and the fly likes Need Help with parse error in PHP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "Need Help with parse error in PHP" Watch "Need Help with parse error in PHP" New topic

Need Help with parse error in PHP

Phani Kumar Venkata

Joined: Jun 18, 2013
Posts: 1

Hello Guys,

I am a newbie for PHP. I have just started today. I wrote a small hello world script but I could not execute it. I got a parser error when i try to run the script. Please see the code below:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
<html xmlns=”” xml:lang=”en” lang=”en”>
<link rel=”stylesheet” type=”text/css” href=”common.css” />
<h1><?php echo “Hello, world! ”; ?></h1>

I got an error like "( ! ) Parse error: syntax error, unexpected '!', expecting ',' or ';' in C:\wamp\www\hello_pretty.php on line 12".

Can anyone help me?
Nick Charles
Ranch Hand

Joined: Oct 09, 2011
Posts: 71

Did you paste this code directly from your editor? If you did, notice that your quote marks are slanted; that's because they are not plain quotes (ASCII 0x22) but rather the enhanced quotes used by a word processor. What editor did you use to create this file? (What OS are you running on?)

Try replacing all of the slanted quotes with standard quotes using a plain text editor.
jQuery in Action, 3rd edition
subject: Need Help with parse error in PHP
It's not a secret anymore!