Jump to content

Recommended Posts

Posted

Hi- I'm very new to php and mysql...I kinda like it lol. I'm working with a tutorial and have mamp set up and working well. Then I added another site into the htdocs folder and discovered I need to configure the server to work with more than one site.

 

Here's the problem. I access the host file via terminal on a mac and my have fowled up the file.

 

 

 

 

I followed the steps at this link which look semi clear:

 

http://www.sawmac.com/mamp/virtualhosts/index.php

 

My host file says command not found. Note- I accessed the backup file by typing this into terminal:

 

sudo cp /etc/hosts /etc/hosts.bak and think I made a mess out of it.

 

How do I set up a virtual host (more than 1 site on the mamp server)?

Is my host file ok?

How do I access the new site after the first one?

What exactly is the host file?

Is virtual just a fancy way of saying multiple sites on one server?

 

Thanks!

Posted
discovered I need to configure the server to work with more than one site.

I'm slightly confused... can't you just put multiple folders within the htdocs folder? That's what I have always done...? You could then access the site using

 

http://localhost:8888/your_site_folder_1

http://localhost:8888/your_site_folder_2

 

(or whatever your localhost URL is)

 

Is virtual just a fancy way of saying multiple sites on one server?

I believe so.

Posted

I'm sure you know more than I do; I get this message when I set the second site up:

 

The site URL prefix [] for the testing server does not match the site URL prefix []specified in HTTP Address for the site

 

The first site works just fine but the second site doesn't show in the browser. I'm entering http://localhost/mysiteA and http://localhost/mysiteB'>http://localhost/mysiteB

 

http://localhost/mysiteB doesn't show. The browser fails to load the page and I get this message:

 

Can't connect to MySQL server on 'tuviano.db.6217275.hostedresource.com' (4)

 

If there's no need to do anything differently what's a virtual server?

 

Thanks!

 

 

I'm slightly confused... can't you just put multiple folders within the htdocs folder? That's what I have always done...? You could then access the site using

 

http://localhost:8888/your_site_folder_1

http://localhost:8888/your_site_folder_2

 

(or whatever your localhost URL is)

 

 

I believe so.

Posted

Sounds like you do not have the second site's config file to point to a active database. Either the config file is incorrect or you don't have a database assigned for the second site.

Posted

You're right. I figured it out. I was given an ip address and changed the http://localhost/siteA to http://siteA and it worked. Why is this? Is it because I'm accessing a remote server vs using mamp?

 

Thanks

 

 

 

Sounds like you do not have the second site's config file to point to a active database. Either the config file is incorrect or you don't have a database assigned for the second site.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...