Getting a php hello world up and running is very quick in OSX. First of all, everything is there already. Apache and php.
To start apache run:
> sudo su
> apachectl start
Then go to http://localhost and you should see:
The web directory is /Library/WebServer/Documents
If you put hello.php there
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo “<p>Hello World</p>” ?>
</body>
</html>
You’ll get this:
To get rid of the extra characters, open httpd.conf in /etc/apache2 directory, find the line LoadModule php5_module libexec/apache2/libphp5.so and uncomment it. (ie remove the # symbol)
Then run:
> apachectl restart
You should now be good to go. If you want MySQL, read here.