Safari doesn't open PHP files

If i try to open a PHP file in safari, it shows the code. If the PHP file isn't local, for example, on a local website (using air sharing on my ipod touch and adding php files to it), it will download the file. If I open it there, it will only display the codes like it does on the original file on my mac. I'm trying to use wordpress but it doesn't work. Once I think i saw some of the page working (it was the login page and it was PHP). But i've tried everything i could do but it never worked again. Please help me! Thanks!

MacBook, Mac OS X (10.4.11), 2.0GHz P, 2GB Memory

Posted on Nov 12, 2008 12:51 PM

Reply
2 replies

Nov 12, 2008 2:39 PM in response to sawmasters

You don't open PHP files in Safari.

Safari doesn't know how to run PHP code so it just displays the file content.

You need to run them under a web server - the web server runs the code and outputs the appropriate content.

By default, on Mac OS X you start up the built-in web server (System Preferences -> Sharing -> Personal Web Sharing) and should place the files in /Library/WebServer/Documents/
You then access them in Safari via something like:

http://localhost/my.php

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Safari doesn't open PHP files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.