Reputation: 31
I am a new guy in web programming who still learning new stuff.
I am creating a web form that consist of one INPUT. I connected the form in the HTML file to the php file. I am using a localhost MAMP that I recently installed on my MacBook.
The Problem : When I open the HTML file on a webpage and type something on the input box and hit submit, the browser ask me to download the php file rather processing it.
I don’t think the problem is related to mysql or apache since when I run the MAMP it give me green signs next to the apache and mysql.
Do anyone know how I can fix this problem and the let the php file open and transfer inputs to the database?
Upvotes: 3
Views: 7022
Reputation: 141
This error is not only about php but general. The file that the browser suggets to down load is simply the script name, php or not.
Upvotes: 0
Reputation: 1034
Did you checked out http://www.mamp.info/en/documentation/faq.html#q8 ?
Maybe you didn't put your site into the folder "htdocs"? PHP won't be parsed unless it is located in that folder or a subfolder.
That would explain the fact that your browser downloads the php file instead of getting the parsed php from apache.
Upvotes: 0
Reputation: 360862
You'll want to make sure that Apache has been told that .php files should be treated as PHP scripts. That means one of the following:
LoadModule php5_module modules/libphp5.so # on windows, this'd be a .dll instead
AddHandler php5-script php
and/or
AddType application/x-httpd-php php
in your httpd.conf file.
Upvotes: 3
Reputation: 157980
open your file from virtual web-server, not filesystem.
you have to type something like
http://localhost/form.html
in your browser's address bar
Upvotes: 1