Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

A website that I'm making on my mac has been giving me issues. I'm trying to create user accounts for the site using php but chrome/firefox keeps downloading it instead. So I use my iPad and it keeps trying to also download the php script. So I'm starting over. How can I:

Prevent Chrome/firefox from downloading my php scripts Is there a basic tutorial for making user accounts on a website? My Setup: Macbook Pro running 10.6.8 Mamp Google Chrome

share|improve this question
    
Do other pages function correctly or is it all php pages. –  toomanyairmiles May 13 '12 at 18:00
    
Make sure your Apache is actually parsing PHP files, and if not, then it requires a re-install or re-check of the files. I have no Mac experience, so I can't really help you. –  ionFish May 13 '12 at 18:33
    
@toomanyairmiles all php files that are on my computer. Not published sites like facebook or google –  Coder404 May 13 '12 at 18:38
    
@Coder404 Obviously, I meant all php files in your site. ionFish is correct, your server is not setup to execute php. –  toomanyairmiles May 13 '12 at 18:59
    
@toomanyairmiles Do you know how to do that on mamp? –  Coder404 May 13 '12 at 19:02
add comment

3 Answers

up vote 1 down vote accepted

Looks like your webserver is not setup correctly. Make sure that it is actually processing the PHP script rather than just serving the file directly to the browser (without any server-side processing).

The most basic of user account scripts is where a username and password are stored in a MySQL database and when a login is posted via a form to the PHP script, the supplied details are checked against the database and if correct, a cookie is given to the user to show that the computer is logged in.

share|improve this answer
    
See the comments above, these files are not on a webserver. –  paulmorriss May 14 '12 at 9:31
add comment

Why don't you just take/copy all the project files to the mamp localhost root directory /Applications/MAMP/htdocs/ then launch the mamp server and go to localhost or 127.0.0.1 on your url.

http://expressionengine.com/wiki/MAMP_setup/#Basic_Setup

Hope that helps.

share|improve this answer
add comment

if your server is asking you to download .php files instead of displaying them, something is wrong with your PHP Handler. This should be set up already in your Apache httpd.conf file, but you can also add it in an .htaccess file like so:

AddHandler application/x-httpd-php .php .html 

or

AddHandler application/x-httpd-php5 .php .html

depending on your server setup

.html is not necessary but just shown here to demonstrate you can list multiple file extensions and have them all be treated as PHP files.

to make sure your server will process .htaccess files, be sure the AllowOverride directive is not set to All instead of None or it will ignore .htaccess files.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.