Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

php script won't run from browser

This is for OS X 10.8.2.


I have followed the various instructions for editing the httpd.conf file and pnp.ini files


Apache launches from http://localhost with the "It works!" index page.


But I can't get the browser to load a PHP file from the destop. My php files appear "greyed out."


However, I can run a php script from the command line. What is the fix for this?


Also, are there official instructions from Apple as to how to set up Apache/PHP under OS X 10.8. Every third-party website seems to have a slightly different set of instructions.


Thank you.

Posted on Jan 25, 2013 12:25 PM

Reply
4 replies

Jan 25, 2013 3:24 PM in response to mwoodruff

Just realized your trying to load the php files by using the File->Open menu item in the Browser. That won;t work.


You have to load the php file by placing it in the Sites folder and entering http://localhost/file.php

(or if you have user Sites enabled http://localhost/~user/file.php)


The reason it is grayed out is that the browser doesn't run (or know of) php files. The web server runs those (via php) and the output of the file goes to the web browser.


This page How to enable Web Sharing in OS X Mountain Lion does a pretty good job of explaining it. (as does the user tip I lonked to before)

php script won't run from browser

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