1

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

5
  • Do other pages function correctly or is it all php pages. May 13, 2012 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, 2012 at 18:33
  • @toomanyairmiles all php files that are on my computer. Not published sites like facebook or google
    – Coder404
    May 13, 2012 at 18:38
  • @Coder404 Obviously, I meant all php files in your site. ionFish is correct, your server is not setup to execute php. May 13, 2012 at 18:59
  • @toomanyairmiles Do you know how to do that on mamp?
    – Coder404
    May 13, 2012 at 19:02

3 Answers 3

2

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.

1

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.

1
  • See the comments above, these files are not on a webserver. May 14, 2012 at 9:31
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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