Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pjkinann

macrumors newbie
Original poster
Feb 5, 2009
13
0
I installed MAMP with no problem. I am able to view the Opening Page and all related pages: phpInfo, eAccelerator, phpMyAdmin, SQLiteManager; however, after defining a site in DW and then placing that site within the MAMP htdocs folder, I am unable to actually view my php site from DW and then viewing in a browser.

The path to MAMP is harddrive > applications > mamp > htdocs

So I placed the web site in htdocs, and browsed for the correct path to insert in the site definition.

When I try to view the page in a browser, namely Safari, MAMP gives error message: Safari can’t open the page “http://harddrive/applications/mamp/htdocs/operationfreedom/index.php” because it can’t find the server “harddrive”.

Why can't MAMP find the server "harddrive" when that is where the Applications folder is located, and then within Applications is MAMP and within MAMP is the htdocs.

Is there somewhere else that MAMP should have been installed? or the web site should have been installed elsewhere??

Thanks for any help.
 
Okay, now I know that's how it looks on my PC. It automatically puts that path in because my WAMP (which I use on the PC) in on localhost.
And I can browse for the folder, which on PC is placed in C > WAMP > WWW > the website folder.

So rather than BROWSE on the Mac, I just type that path in? http://localhost/filename.php??
 
Okay, now I know that's how it looks on my PC. It automatically puts that path in because my WAMP (which I use on the PC) in on localhost.
And I can browse for the folder, which on PC is placed in C > WAMP > WWW > the website folder.

So rather than BROWSE on the Mac, I just type that path in? http://localhost/filename.php??

Bit hard to explain but I'll try.

The server does not use the same path structure as Mac OS X (neither does it on Windows).

http://localhost/ is exactly equivalent to navigating to /harddrive/applications/mamp/htdocs in your example above.

Therefore if you want to access a file called my_example.php in the folder examples in htdocs via a web browser you would visit http://localhost/examples/my_example.php and that will display the file in the browser.
 
That is not the path to the folder. http://localhost/operationfreedom

When defining a site in DW, you browse to the appropriate folder where the site is located rather than type it in. So localhost is not the root site where the folder is located.

The root site of the folder is:
Harddrive/Applications/Mamp/htdocs/website-folder

When defining a site in DW on my PC, I browse to the folder on WAMP/www/folder and I can view it just fine in a browser.

But the same procedure is not working with Mac and MAMP.

And I went ahead and tried tpying in http://localhost/operationfreedom (which is the name of the folder for the website) and I receive this message:
WARNING: The selected folder does not contain the current site's home page. The site map cannot be built.

So you HAVE to have the correct path on the defined site, or it will be impossible to view the page in a browser from DW.

There are 3 areas in DW where you browse for the local root folder: local info, remote info, testing server. It has you browse for the location of the root folder. Each time the location is the same, but MAMP is not recognizing the harddrive as part of the path??
 
Therefore if you want to access a file called my_example.php in the folder examples in htdocs via a web browser you would visit http://localhost/examples/my_example.php and that will display the file in the browser.

Okay, if I just open any browser and type in http://locahost/operationfreedom (that is the name of the folder with the website in it), I will get this:
The requested URL /operationfreedom was not found on this server.

That's because my server is MAMP>htdocs>operationfreedom.

If I open DW and I am working on my file index.php within the folder operationfreedom, and I go to file > view in browser, if I have the path correct to the MAMP server (by browsing for that folder when defining a site in Dreamweaver) then it should by rights be viewable within the browser.

I shouldn't have to open the browser first, type something in and then hope to find the folder somewhere on a server that is non-existent.

Now, I agree with you, when I'm on my PC (using WAMP), I can view my file in DW, view in browser, and it will take me to the localhost.

On my PC using WAMP, I browse for the testing server and the root site which would be C:/wamp/www/operationfreedom/index.php and that is how I define a site in DW using WAMP. When I view that document through DW in a browser, the path is AUTOMATICALLY http://localhost/operationfreedom/index.php.

I didn't have to specifically type it in. DW finds it automatically because I defined a site in DW first, browsing to the path of the root folder which is the C:/wamp/www/operationfreedom/index.php

So going back to the MAC, using MAMP, if I browse to the root folder, the location is: harddrive/applications/mamp/htdocs/operationfreedom/index.php

Then I go back to DW and VIEW the file in a browser (using DW to do that), it should go directly to the root site which I have defined. I shouldn't have to type in anything.
 
Okay, if I just open any browser and type in http://locahost/operationfreedom (that is the name of the folder with the website in it), I will get this:
The requested URL /operationfreedom was not found on this server.

That's because my server is MAMP>htdocs>operationfreedom.

It sounds like you have something misconfigured. That is the correct path assuming you have an index.html / index.php / index.jsp or whatever file in the root of that folder.

Do you have the built in OS X web sharing turned on? If so turn it off.
 
Well, I know how to DEFINE a site in DW. I do it all the time on the PC, and I've used the same procedure on the Mac. It works on PC; it doesn't work on Mac.

But I'll check that out anyway just to see if there is something different about the mac (as it CAN be an oddball at times).

Thanks!
 
no no no no

MAMP uses a separate host.

first: did you start mamp? if not go to applications> mamp> and click the mamp icon. Make sure you have two green lights.

If you have the green lights, go to the htdocs in the mamp folder.

The go to http://localhost:8888/ and you should see the directories or files you placed there.

If you need further help I did a video tutorial on this.

http://www.dreamweaverclub.com/vtm/mamp.php

click the link for further assistance.


Also the localhost in mamp is localhost:8888. Mac comes with Apache and PHP pre-installed so the mamp developers put the localhost @ localhost:8888 so it would not conflict with the preinstalled versions on mac os x
 
Bravo, neonflux.

I read all the previous replies (prior to yours) and was astounded. Thank you for actually explaining how MAMP works.

I'd like to explain (once and for all) what the OP has yet to learn - the concept of "document root", hostnames i.e. localhost, and ports.

Document root =[SIZE=-1] The server path (not root) that is accessible by web visitors. While it could be the server root, it is commonly set as a secondary directory such as public_html, or htdocs, etc. for security purposes at a level higher than root.[/SIZE]

Let's break down http://localhost:8888

http:// = Hyper text transfer protocol, that protocol that identifies to the browser what follows is a web site hostname. The :// is a unique sequence of characters to separate the hostname from the protocol.

localhost = The IP address of your ethernet interface connected to your computer, usually 127.0.0.1. It's the default "english" hostname for that IP address as per specifications that define routing. You could use the IP here if you wanted. The main purpose of DNS is to translate the hostname to it's associated IP, so either can technically be used. Even local hostnames such as "myimacwebserver.com" can be defined and mapped to 127.0.0.2 or 127.0.0.3 if one knows how to edit the hostnames on a Mac and configure Apache virtual host to use the IP. Great for sandbox testing, meaning local development.

MOST IMPORTANTLY - the hostname is associated with the physical path on the server to get to the document root, either setup as a virtual host in Apache or in the Apache global setup in its configuration file.

8888 (with the colon before it as a separator) = the port to use to route the data. 80 is the default http port, and many Mac's already have Apache running using it. Ports cannot be shared so 8888 is a popular "open" port which means it usually is not blocked by a local firewall and good for sandbox testing. It's the combination of hostname and port that tells the browser how to communicate with the server (Apache) which in this case is local.

Put it all together, read left to right, "Using http, access a server named localhost on port 8888" and since locahost is associated with Apache running on your own computer, the web site is served locally.

Internet 101 folks. You should know this basic stuff if you're start developing for the Internet. The OP should see now that the hostname is not a path.

Disclaimer: This was a novice tutorial, I skipped over alot of technical stuff and exceptions, common setup stuff, etc. to KEEP IT SIMPLE.

-jim
 
Do you have the built in OS X web sharing turned on? If so turn it off.

Now I never thought of this. How do I turn it off? Maybe it's conflicting with MAMP??

first: did you start mamp? if not go to applications> mamp> and click the mamp icon. Make sure you have two green lights.
LOL, oh, of course! But I understand the need for asking, just like people who ask tech support why is my computer screen black? Uh, duh... because it's not plugged in? LOL

But yes, it is running properly, and I can view the Start Page.

If you have the green lights, go to the htdocs in the mamp folder.

The go to http://localhost:8888/ and you should see the directories or files you placed there.

YES! you are RIGHT! !!!!!Here is what I was missing!!!!: because I included the NAME of the folder, MAMP couldn't find it.!!!!

So even though the path to the folder would be http://localhost:8888/operationfreedom/ , it never shows in DW unless I leave off the folder name.

I'm assuming if I had folders: folderA/ and folderB/ and folderC/ all websites, and I am in folderB in DW at the time, then when I view the index.php page of that specific site, DW and Mamp know which folder to go to and will view the appropriate index.php folder, which in this case would be in folderB.

Is that correct?

On PC, when there are MANY folders in the www folder, equivalent to the htdocs folder in MAMP (wamp/www/folder1, wamp/www.folder2, wamp/www.folder3), when I DEFINE a site in DW, I have to also list the appropriate folder for that specific website in the http address.

But then, maybe NOT? I've actually never tried doing it w/o listing the actual name of the folder (even though I've never had a problem viewing the actual website).

SO WOW! thank you!!! I've searched high and low for an answer to this one and YOU DID IT.

All I had to do was leave OFF the folder name! (unlike on a PC).

And to think that I uninstalled and reinstalled MAMP about 6 times, and redefined my site about a dozen times wondering why I could define a site in DW on my PC, but not on Mac :D, and THEN I moved that folder about a dozen times from the webserver folder to the htdocs folder, then even moved it to my own location and pointed MAMP to the root folder as being somewhere else! on and on and on! gee! I got a lot of experience running around MAMP!

And all this time, all I had to do was remove the words operationfreedom (folder and website name) from the http address in MAMP :( oh my...

So thank you VERY MUCH for sticking this one out! It is VERY MUCH appreciated, and you are the ONLY FORUM who has finally been able to help me, instead of giving me all this absolutely abstract and unnecessary information and advice.

You just went right to the point and YOU DID IT! Geniuses on this Mac Forum!!!

thank you again so much!
 
When you go to view a file you use localhost to see it.
Try:http://localhost/filename.php

See, this is where I was confused, because in my case I have the websites in various folders in the localhost, so when I kept seeing this path (above) I assumed that it would mean IF I had just a FILE in there, and not a folder.

So that is why I kept adding http://localhost/operationfreedom/index.php

In your last post when you said just view your file in http://localhost:8888/ THEN I realized I did NOT need the name of the folder of my website in the htdocs folder. So I went back to the define site in DW and changed the http address to omit the folder name and VOILA! there was the index.php when I viewed in a browser!

GENIUS! and a patient one at that! :D
 
OH my gosh! of course not Neonfluxx. You are just trying to help like everyone does on this forum, and I appreciate anyone who has suggestions!

Sheesh! I hope I didn't offend anyone trying to get my point across by explaining it so many times. :( Sometimes trying to explain something online, instead of being able to show someone, is really quite a challenge of the descriptive word bank! :D

I'm just grateful to you both for being so helpful and making suggestions, and it's now all sorted out and that's the best part.

And thank you Cromulent as well.

Thank you everyone for your input.
 
I have another question. When I install additional folders in the htdocs folder of Mamp, I notice that using http://localhost:8888/ gives me an error message because then it is confused as there is more than one folder, thus more than one index.php even though they are in separate folders.

With only one website folder in the htdocs folder, when viewing the page in a browser it automatically picks up the index.php page of that one folder.

However, if I put another website folder in there. That is when I get the error message, even though I'm on the correct defined site in Dreamweaver.

So, on my PC I don't have this problem (with wamp) because instead of just http://localhost:8888/ I have the name of the folder also:
http://localhost:8888/foldername, thus when viewing the page it goes to that folder.

But if I do that on the mac, then the page won't view at all -- it can't find the server.

So how do you designate separate website folders within the htdocs page
 
okay lets have a lesson using mamp.

first: you can have multiple folders in the htdocs with no issues. I do it all the time.

if your gonna have seperate folders than each one should have their own index file as well. There should be no index file in the htdocs folder, only in the separate folders.

To view the individual folders you would go to http://localhost:8888/folder name
 
Setting up the domain name: The steps required vary depending on your purpose. If your purpose is soley your own test needs, then perhaps the domain name doesn't have to be visible from anywhere outside your computer. Maybe the domain name can be a fiction you configure inside your computer and isn't visible to any other computer.

If this is the case, simply edit /etc/hosts and add this line:

127.0.0.1 domain.test
This makes your computer believe the host name domain.test is in reality the IP address 127.0.0.1, or your local host. Hence, in a web browser requesting http://domain.test will contact the web server on that computer.

Of course if the domain names you are configuring need to be known by others, then the domain names need to be part of the regular....


Okay, that is way more than I understand right now.
 
To view the individual folders you would go to http://localhost:8888/folder name

Thank you. That's how I do it in Wamp, but the only reason it wasn't working in Mamp is because I then needed to change the preferences in Mamp, and also needed to change the http in DW site definition.

So NOW, at last! :D I can put more than one folder in there, like I do on PC.

Wow! that was a long time coming, huh!! quiet! LOL

Just that I'm not as familiar with Mac as I am with PC, and even though I knew the procedure on PC, it was a little different on Mac, similar, but kind of a round about way of doing things.

I think I finally have it! :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.