How to fix parse error in xampp?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to fix parse error in xampp?

Postby cafenubia » 22. February 2009 23:06

Ive installed xampp on my pc and ive paced a test file in my xampp htdocs file and its address is http://localhost/test/phptest.php,when i pull it up it shows this error......

Parse error: parse error, expecting `','' or `';'' in C:\Documents and Settings\Owner.BHAL\desktop\xampplite-wi... on line 7

And this is the php file

<HTML>
<HEAD>
<TITLE>PHP Testing</TITLE>
</HEAD>
<BODY>
<?php
echo “If this works, i <i>really</i> did it!”;
?>
</BODY>
</HTML>

Can anyone help me with this problem.
cafenubia
 
Posts: 2
Joined: 22. February 2009 22:59

Re: How to fix parse error in xampp?

Postby Izzy » 22. February 2009 23:39

cafenubia wrote:Ive installed xampp on my pc and ive paced a test file in my xampp htdocs file and its address is http://localhost/test/phptest.php,when i pull it up it shows this error......
Did you place the file phptest.php in the xampp\htdocs\ folder or in the xampp\htdocs\test\ folder?

In the xampp\htdocs\ folder the address to type in the address bar of your browser is:
http://localhost/phptest.php

In the xampp\htdocs\test\ folder is:
http://localhost/test/phptest.php

BTW, you can't double click on the phptest.php file to parse the php, it has to go through a server to parse the php code.

Parse error: parse error, expecting `','' or `';'' in C:\Documents and Settings\Owner.BHAL\desktop\xampplite-wi... on line 7
Try this php code:
Code: Select all
<?php
echo 'If this works, i <i>really</i> did it!';
?>


Finally clear your browser's cache often as it is your worst enemy when developing at localhost level.
Last edited by Izzy on 12. March 2009 11:09, edited 2 times in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: How to fix parse error in xampp?

Postby Wiedmann » 22. February 2009 23:52

Code: Select all
echo “If this works, i <i>really</i> did it!”;

You should use a better text editor for PHP files:
PHP expect apostrophes or straight quotation marks for string, but not a typographic curved quote.
--> http://de.php.net/manual/en/language.types.string.php
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: How to fix parse error in xampp?

Postby cafenubia » 23. February 2009 00:31

Izzy wrote:
Parse error: parse error, expecting `','' or `';'' in C:\Documents and Settings\Owner.BHAL\desktop\xampplite-wi... on line 7
Try this php code:
Code: Select all
<?php
echo 'If this works, i <i>really</i> did it!';
?>




Thanks for the replies Wiedmann and Izzy,

Izzy I used your code and it fixed my problem,ive been wrestling with this almost two days and i come here and its solved in less than a hour,thats cool.......... :D

Do you have any idea why the other way didnt work i used my notepad first and then i used php designer to create the file and it produced the same result.

Im following a php tutorial step by step and thats the way they told me to display the php page.
cafenubia
 
Posts: 2
Joined: 22. February 2009 22:59

Re: How to fix parse error in xampp?

Postby Izzy » 23. February 2009 01:09

cafenubia wrote:Do you have any idea why the other way didnt work i used my notepad first and then i used php designer to create the file and it produced the same result.

Im following a php tutorial step by step and thats the way they told me to display the php page.
In Notepad always save as text not any other encoding like utf-8 for example.

I don't know your php designer but it should have a syntax checker built in and make sure the designer saves the file as text not any other encoding like utf-8 for example.

I don't know what tutorial you are following but the php manual is quite clear on this issue with many examples:
http://us.php.net/manual/en/language.types.string.php
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 126 guests