1

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:

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

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

localhost/testphp.php

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?

2

First:
Are you really going through the server?
Try

`http://localhost/testphp.php`

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

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.