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

kirstin ahmed
kirstin ahmed
1,935 Points

My home page doesn't have the same URL as Randy's in the video for "enhancing your application - cleaning up the URL's"

Ive followed the videos until this point, however when I look at my index.php in my browser the URL is: http://localhost:63342/htdocs/index.php and according to the video it should be: localhost. I think this is what is causing me problems further down the line as my site root doesnt seem to match up with what we are setting it to.....maybe??

16 Answers

It sounds like you're not pointing to your directory properly.

Are you on MAMP?

Matt Trask
Matt Trask
10,027 Points

Sounds like somehow the port your server is looking at got messed up. You can take a look by going to the server panel where you turn it on and then go to the ports screen and look at what the port forwarding is. You should make it 8080 or 8888 for simplicity

kirstin ahmed
kirstin ahmed
1,935 Points

Thankyou guys - Matt do you mean the apache port? In one of the videos Randy asked us to set it to 80, which it is, shall I set it to your suggestion? Or do you mean mySQL port which is currently set to 8889?

Matt Trask
Matt Trask
10,027 Points

Yea the apache port. Cause the port in the url means that you arent on port 80 or port 8888 or anythng else.

kirstin ahmed
kirstin ahmed
1,935 Points

OK done. Absolutely no change in the URL displayed which is still : http://localhost:63342/htdocs/index.php

Matt Trask
Matt Trask
10,027 Points

Try removing the port, and just enter http://localhost/

You shouldnt need to enter HTDOCS since the server is already looking at that file.

kirstin ahmed
kirstin ahmed
1,935 Points

I get this : This webpage is not available

Matt Trask
Matt Trask
10,027 Points

then it sounds like theres something wrong deeper then MAMP. What port is in the url if you go to the mamp app and turn it off and then turn it back on and let it take you to the start page?

Wait wait wait - hang on. I don't think this is a port issue because you're accessing your site fine through localhost with whatever port you're using... It looks more like you've told MAMP to look in the wrong place for your website, which is why you're having to add unnecessary directories to your url. Although your ports are pretty strange - check my comment below on how to reset.

Open Mamp and go to preferences.

There should be a tab called 'Apache' (it may have changed - if it has, you're looking for an input field with a label of document root. it should be sitting inside one of the tabs in the preferences area!).

Open up that tab and select a new directory. You're going to want to select the same directory where your websites is sitting.

it looks like that location should be the htdocs folder (judging by your url - http://localhost/htdocs/)

It should ask for your password and restart automatically.

let us know how you get on!

To reset your ports, go to 'preferences' again.

Click the button that says 'Set to default Apache and MySQL ports', then okay.

You should have an Apache Port of 80 and a MySQL port of 3306.

hit okay, and if it doesn't restart automatically, restart it yourself.

visit http://localhost

What happens?

Matt Trask
Matt Trask
10,027 Points

Its gotta be something with MAMP, cause they tried to go to the standard start page and still took them to port:63342. Either that, or they have another program running that could conflict with mamp.

kirstin ahmed
kirstin ahmed
1,935 Points

Thanks Tom 1=My root folder was set correctly to mac>applications>MAMP>htdocs so I "ok'd" that and there was no need to enter my password 2=I had the option to set MAMP ports to default which were 8888 and 8889 or to "set apache and mysql ports to 80 and 3306" and in both instances after trying these potions my index.php page still gave this : http://localhost:63342/htdocs/index.php when i viewed it in the browser

Matt Trask
Matt Trask
10,027 Points

Is that what you are using, PHPStorm?

Yeah maybe, but a lot of users still saying it doesn't conflict with other local servers.

Before diving any deeper, I would try the following - BUT only after either clearing your browsing history or using a 'private' or 'incognito' window.

Stop and close everything, restart MAMP only. Can you visit http://localhost?

If it hasn't worked, you've got an issue with MAMP.

If it has worked, start up phpstorm and see what happens.

kirstin ahmed
kirstin ahmed
1,935 Points

Hi Tom No that hasnt allowed access to any page. I get : This webpage is not available So "an issue with MAMP" could mean anything right?? Would you suggest I uninstall and try to reinstall and test by doing the same as above or something other?

kirstin ahmed
kirstin ahmed
1,935 Points

Guys

I have uninstalled MAMP and reinstalled it, I know have the power button showing green when I start the servers which is new for me so your presumption seems right - and as you thought it does indeed work when I type http://localhost - so THANKYOU

btw I now have a third port option to configure in MAMP that of the Nginx port currently set to 7888 does anyone know what this should be set to?