Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Getting Started with PHP Install PHP on Mac OS X

Yang Pan
Yang Pan
2,397 Points

Explanation of changing Apache Port

Hi, the video suggests changing the Apache port from 8888 to 80. I see that changing it to 80 allows test.php to be opened even though it is not named as "index", but I was hoping for a detailed explanation of this. After changing my Apache port, I can load test.php, but other files I had been working on that were referenced by "index" and in directories different than htdocs can no longer be loaded. Is the port 80 something specific with htdocs?

1 Answer

I haven't taken the PHP course you're referring to, but port 80 is usually the default port for the HTTP service (which stands for Hypertext Transfer Protocol). Which is why you don't need to specify the port number when you view your site in a web browser. The browser assumes port 80.

Technically, you could have kept the original MAMP port of 8888, but then you would have to specify the port in the browser by doing this:

http://localhost:8888

The htdocs folder is where you would place all your website's files that you actually want to be accessible from a web browser. Other files, such as your databases, error logs, security credentials would be placed OUTSIDE htdocs, since you wouldn't want outsiders to be able to access them.

Check out the following links for more details and images that hopefully explain things better.

HTTP Made Really Easy - What is HTTP?

Setting up and using FTP - has images and explains the directory structure typically found on hosting web servers.