MAMP not running PHP Correctly? BUILD YOUR OWN DATABASE DRIVEN SITE, 4th

Hi there,

I’m starting chapter three of your book BUILD YOUR OWN DATABASE DRIVEN SITE, 4th Edition — and MAMP is up and running.

However, when I look locally on my browser, the PHP pages from your code aren’t displaying properly. I just see the HTML code.

Did I miss something?

Thanks,
Jason :slight_smile:

Hi jayfray84,

What steps have you taken to set up MAMP? Are you using the default folder, or have you set up your won etc? What are you pointing your browser to? In what form have you saved your code? As something like page.php?

I’ve installed MAMP exactly as prescribed in the book. There is a MAMP folder in Applications.

I’m able to access MySQL through the Terminal, and when I got to http://localhost – I get the correct “It Works” message. So, MySQL and Apache are working – it’s just PHP that seems to not be engaged (locally).

Now, I want to start playing around with the topics, so I have a folder on my desktop with the sample projects from the SitePoint site. But when I click the “I’m Kevin” link from Chapter 1, when it goes to the .php page, it doesn’t display correctly. I see the literal code displayed…

Weird?

J :slight_smile:

it sounds like you haven’t got your sample projects in MAMP’s document root folder.

I’m using XAMPP (which is basically a MAMP equivalent) but the concepts will be the same.

you need to find which folder on your mac your http://localhost points to (it will be somewhere under your MAMP installation) and put your project folders there.

say you have a project called proj_1 with a home page called index.php

then when you put the proj_1 folder in MAMP’s document root folder, entering http://localhost/proj_1/ in your browser should then open up index.php

Thanks Kalon — you helped lead me to the right answer! Things look good now! :wink: J

that’s ok :slight_smile:

it took me a little while as well to work out what was going on the very first time I installed XAMPP on my pc.