Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed MAMP 2.1.1 on OS X 10.7.4. The MAMP Start page says everything is running.

MySQL is running, I can issue command line commands in Terminal. I tested PHP by typing:

php -f testphp.php

where testphp.php contained one line of code:

<?php echo phpinfo(); ?>

In the terminal window, this returned the expected - an extensive listing of PHP config info. All appears to be well, but if I direct Safari to a simple PHP page, instead of seeing the page run, I get a listing of its source code!

I built a page whose body is:

Testing PHP:
<?php echo phpinfo(); ?>

I called it testphp.php. If I go to :


I see the source code listing! If I rename the file to testphp.html, I see:

Testing PHP:

but that's all - the line of PHP code produces nothing.

Can anyone explain why my localhost server won't talk PHP?

share|improve this question

Are you really going through the server?


Is the server set up for php? Is the server set up to read from wherever you have your source file?

share|improve this answer
I found most of the answer at… Note that the virtual host configuration didn't seem to be necessary. – Marc in Felton Aug 8 '12 at 9:53
After following the info at… – Marc in Felton Aug 8 '12 at 9:54
After following instructions at‌​a-web-server – Marc in Felton Aug 8 '12 at 9:55
I am running PHP pages now. I'm having a problem accessing MySQL now, though... but I got PHP fixed! – Marc in Felton Aug 8 '12 at 9:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .