0

I have installed MAMP on my mac (OS X 10.9.5) and am unable to get php files to work correctly.

My php file looks like:

<?php
phpinfo();?>

This file is stored in the MAMP/htdocs folder.

When I load this in a browser (tried Chrome and Safari) with http://localhost:8888/test.php, I get the following errors:

From the php_error.log:

[19-Oct-2015 05:06:57 Europe/Berlin] PHP Parse error: syntax error, unexpected '?>', expecting identifier (T_STRING) in /Applications/MAMP/htdocs/test.php on line 9

From the apache_error.log:

[Sun Oct 18 22:49:25 2015] [error] [client ::1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store

It looks like the version of MAMP that I have installed is running Apache2.2. I'm new to this, and have researched a number of resources to get help. I'm wondering if I need to edit the apache config file somehow? Not sure what to change. Would appreciate some advice!

I should also add that when I load a test1.php file (http://localhost:8888/test1.php) that just has basic html in it, everything works fine.

pcutter
  • 9
  • 2
  • Please add your `test.php`. – Niranjan N Raju Oct 19 '15 at 03:23
  • test.php is the simple 2-line code shown at the beginning of my question. – pcutter Oct 19 '15 at 10:12
  • which is line number 9 in `test.php`. Error is in that line. – Niranjan N Raju Oct 19 '15 at 10:25
  • Your posted source code doesn't have a syntax error in, as far as I can see. And it doesn't have nine lines, so it can't be causing the error you posted. (And your apache_error.log message looks like a red herring, especially since it's from about six hours before the PHP error.) – Matt Gibson Oct 19 '15 at 12:32
  • Thank you @John Conde. Turns out the text editor I was using must have put some invisible characters in my file. Once I recreated the file in another editor, things worked just fine! – pcutter Oct 19 '15 at 12:55

0 Answers0