Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

jeff creamer
jeff creamer
23,733 Points

MAMP/WAMP best practices: Build a simple php...

Hey all, I've just started Randy's php course. Now that I've installed MAMP, did the exercises and am done for the day; what are the best practices for using and 'putting to sleep' my local server? On the MAMP panel, do I just hit "Quit"? (or "Stop servers" or both)? What do you folks/pros who use it alot do?

And question #2: why did we change the apache port from 8888 to 80?

Thanks so much for any insights. Cheers.

7 Answers

samiff
samiff
31,206 Points

Be sure to STOP servers before exiting the program just to make sure no data is corrupted (more important when you start using databases). I only run my local server when I'm developing. Port 80 is the default TCP port used by HTTP. You could still use 8888, but you'd always have to add that to the end of your web address when testing (80 is assumed).

jeff creamer
jeff creamer
23,733 Points

Hey Sam, thanks much for the info!

Running a computer with port 80 open might leave you open to HTTP vulnerabilities. Say you configured your router to be in the DMZ [http://en.wikipedia.org/wiki/DMZ_%28computing%29], and leave your computer on all night. A malicious person could just be port scanning and find your computer with open port 80, and launch attack(s) at your computer on port 80.

I use XAMPP, I tried WAMP but didn't care for it much.

James Barnett
James Barnett
39,199 Points

Craig - Whether you have port 80 open or port 8888, it makes no difference.

If a person were running a port scanner, they most likely included 80, 443, 8080 & 8888 as those are all common ports on which to run a web server.

jeff creamer
jeff creamer
23,733 Points

@Craig, interesting read. I'm doing the MAMP thing for the php course and soon for local dev. Thanks for the heads up and for chiming in.

@James, thanks for the clarification that it's any open port. So what are some other best practices when running VMs, W/MAMP, etc relating to security?

James Barnett
James Barnett
39,199 Points

jeff -

So what are some other best practices when running VMs, W/MAMP, etc relating to security?

TL;DR - Go to yougetsignal.com and test ports 80 and 8888, if it says closed your good.


In general you don't want your VMs, W/MAMP, etc be accessible from the outside world. The good news if your private and public IPs are different, then in order for someone outside your local network to access your VM you would need to configure port forwarding first.

The easiest way to make sure that your VM isn't accessible outside your local network is check using the port forward tester over at yougetsignal.com. Try both ports 80 and 8888, if it says that the port is closed then that means someone outside your network can't find your VM and that's a good thing :smile:

If you want to learn more check out, the home networking article from how stuff works.