Reputation: 147
I'm working through a PHP tutorial and I'm having issues because I can't open local php files in firefox. I just get prompted to open them with another program. I'm using a mac, btw. Things I've tried/already know:
I've been looking all over the internet for a solution to this, it seems really crazy to me that I can't find anything. I know there are some similar questions posted on here, but they all seem to have particular aspects that don't apply to my case. I also found something about this on the MAMP forums but it was never resolved from back in 2008. Anyone?
Upvotes: 2
Views: 6893
Reputation: 199
All who are having this problem should check this link. After doing this it seems the problem is not MAMP but with firefox because my websites worked with Safari on port:80 after following these simple instructions but still not with Firefox. I hope I helped and goodluck.
Upvotes: -1
Reputation: 11
Well the solution is rather simple actually:
If you are not suffering from any conflicting software your php should run and you will see the desired page.
Right clicking and directing the file to open with Firefox will not help. I'm sure there is a better and proper solution. But if you are in a rush for a quick fix - this is it!
Upvotes: 1
Reputation: 147
I worked through these instructions to solve a problem I was having with setting up my local Sites directory after upgrading Yosemite and then I could actually open the PHP file. Then I had to go to my httpd.conf file in /etc/apache2
and uncomment LoadModule php5_module libexec/apache2/libphp5.so
to get the PHP to actually load.
For a summary of what is included in the instructions for setting up apache after upgrading to Yosemite, see my answer in this post .
Upvotes: 0
Reputation: 1
PHP files are just code. If you try to make a browser open it, all it knows to do is download the text file. You need to make sure that your code is being interpreted by PHP via your HTTP server.
Upvotes: 0
Reputation: 31501
Firefox has had an intermittent bug for years in which it would prompt for download files which should be shown in the browser. Many times this could be attributed to incorrect MIME type configuration, or to a misconfiguration in the webserver's presented Content-Type
or file handlers. However, I have personally diagnosed with Wireshark conditions under which the webserver would present the proper Content-Type
and the browser was properly configured.
Therefore, you should:
Content-Type
Content-Type
presented by the server.Upvotes: 0
Reputation: 41
This can mean that you don't have PHP installed, or PHP is not configured correctly. You need to ensure the file is in the directory where your webserver is installed and you need to request the script via your localhost/path/to/file/ you cant just open a PHP file in firefox you will need to request if via your webserver.
Upvotes: 2