PHP syntax error

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

PHP syntax error

Postby prbell » 31. October 2014 11:07

I have the latest version of XAMPP running on a new Macbook (OSX 10.10 Yosemite). As far as I can tell at the moment, Apache and MySQL are working ok, but testing PHP using <?php echo 'Hello world'; ?> brings up

Parse error: syntax error, unexpected 'world’' (T_STRING), expecting ',' or ';' in /Applications/XAMPP/xamppfiles/htdocs/test.php on line 2

I have looked for an answer on the forum (to which I am new) but so far to no avail, and being new also to OSX and PHP would be grateful for any suggestion as to what may need tweaking to resolve the issue (e.g. something in OSX, or php.ini, or something else).

Many thanks.
prbell
 
Posts: 2
Joined: 31. October 2014 10:31
Location: Norwich UK
Operating System: OS X 10.10 Yosemite

Re: PHP syntax error

Postby Altrea » 31. October 2014 12:22

prbell wrote:’

Thats an ISO-8859-1 expression of an "right single quotation mark" (U+2019) This is not a valid single quote (U+0027).
Check your code and replace the wrong single-quotes with the correct single-quotes
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: PHP syntax error

Postby Nobbie » 31. October 2014 13:50

You should also get rid of the problem that your code seems to start at line 2 (instead of line 1), according to the error message. You *should* start in line 1. If you cannot see the reason for this, there may be a problem with the text editor, which eventually inserts a "Byte Order Mark" (BOM) at the beginn of the file (in case of UTF Coding).
Nobbie
 
Posts: 8775
Joined: 09. March 2008 13:04

Re: PHP syntax error

Postby prbell » 31. October 2014 15:25

:oops: Thank you both. Message received: "You need a code editor on your Macbook"!
prbell
 
Posts: 2
Joined: 31. October 2014 10:31
Location: Norwich UK
Operating System: OS X 10.10 Yosemite

Re: PHP syntax error

Postby JJ_Tagy » 31. October 2014 19:32

Text Wrangler is good and free.
JJ_Tagy
 
Posts: 678
Joined: 30. January 2012 13:44
Operating System: Windows 10 Pro x64


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 6 guests