PHP Using PHP with MySQL Connecting PHP to MySQL Installing MySQL with MAMP

Naomi Freeman
STAFF
Naomi Freeman
Treehouse Guest Teacher

MAMP only launching MySQL

Hi there,

I tried to install PHP earlier today using MAMP, on my Mac.

I couldn't get localhost to go. I checked the internet, tried to change some things in my Activity using Force Quit - nothing worked.

I noticed there's this later video about using PHP with MySQL, so I decided to do this instead.

However, I've noticed something is wrong with my MAMP. When I click Start Servers, only MySQL Server box gets shaded in, not the Apache server.

Also, once the servers are started, I don't have the option to "Open start page". It's shaded out and unclickable.

Can anybody pretty please advise how I configure this? I need a PHP environment to open a JS game test an interviewer sent me this morning :( I'm primarily Ruby and my comp is not configured at all for PHP.

Thanks so much.

4 Answers

Holger Liesegang
Holger Liesegang
50,595 Points

Hi Naomi,

MAMP should work "out of the box" on a Mac - anyhow what are your Mac OS and MAMP versions? Did you try "Starting Apache and MySQL with system" on the general tab? Also you will have to add the port 8888 to your localhost if you didn't change this on the general tab --> http://localhost:8888

Also Zac Gordon made some great videos about this: Installing a Local Web Server on a Mac and Customizing Your Local Server Setup on a Mac

Oh and BTW the brand new MAMP 3 hast just been released - maybe you want to give it a try :)

Kind Regards Holger

Naomi Freeman
Naomi Freeman
Treehouse Guest Teacher

https://www.dropbox.com/s/tptx2hgf41z5nxn/Screen%20Shot%202014-03-07%20at%201.03.28%20PM.png

This time I started the server and neither box went grey. See how I can't click the Open start page?

This is my mac info: 21.5 inch, mid-2011 OS X Version 10.9.2 Processor: 2.5 GHz Intel Core i5 Memory 4 GB 1333 MHz DDR3

MAMP I just downloaded today. What is the general tab? Where do I find it to add the port to localhost? Will this affect localhost:3000 for my rails stuff?

Thanks so much for your help!

Jo Albright
Jo Albright
5,199 Points

Naomi Freeman - No it should not affect your Rails server. I have ran a Rails server and MAMP at the same time on my Mac. I do not know much about the regular MAMP setup as I use MAMP Pro. If you are still having issues, we could screen share using Screen Hero to check out what might be going wrong.

Holger Liesegang
Holger Liesegang
50,595 Points

Sorry for the delay but at the moment this forum unfortunately doesn't seem to inform one about added comments but only posted answers and kind of "@name" stuff. I just now found your added comment by chance.

And of course sorry for the confusion with the "general tab" as I'm using the MAMP PRO Version (I need the virtual hosts to serve different websites/systems). It's under 'Preferences > Ports' in your version as described by Zac in his videos. You'll find more Info in the MAMP-3-User-Guide for your version. Also be sure to check out the MAMP FAQ

You wrote "Will this affect localhost:3000 for my rails stuff", so do you already have another (perhaps conflicting because listening to the same port) Apache running in the background of your system? You can run more at the same time but you have to change the port of the other ones to different ports. That could be 80 or 8888 for example if you already use 3000 for another one. But I wonder why it doesn't want to start with you because the standard port for the MAMP Apache is 8888.

Naomi Freeman
STAFF
Naomi Freeman
Treehouse Guest Teacher

Holger Liesegang Got it figured out :) I'm not sure if I read it on Treehouse or somewhere else, but some tutorial showed me to move my htdocs to the sidebar.

That was the problem. As soon as I moved it back in, good to go!

Thanks for following up. I appreciate it.

I've since learned that I could've changed my .php to .html and everything would've been fine - but you don't know til you know, right?

Thanks again.

Holger Liesegang
Holger Liesegang
50,595 Points

Naomi Freeman Glad everything is ok now. As Jo Albright already said the Rails Server runs ok with MAMP PRO (mine too and I really need those virtual hosts :) )