I am trying to install Apache on my Mac (OSX 10.8.2).
I am using MAMP, it runs, but whenever I try to view a page (html or php) other than the phpinfo.php, I only see the source code.
There are no errors in the log file.
I have also tried with the pre-installed webserver, same result. Same for XAMP.
How can I get the server to interpret the logic instead of printing it?
Try typing instead of localhost 127.0.0.1 like 127.0.0.1/index.php
Educated guess. You've tried this code and it runs flawlessly:
<?php
phpinfo();
?>
Now you've copied some PHP code that looks like this:
<?
foo();
bar();
?>
... and it's being ignored by the PHP interpreter. Please note the important difference: <?php
vs <?
.
If that's they case, you need to do one of these:
<?php
..htaccess
or your php.ini
file. You'll find the path to php.ini
in the outout of phpinfo()
.