Sorry, I forwarded this worng the first time...

--Brian

-----Original Message-----
From: Brian E. Beck [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 2002 8:17 AM
To: j.urban
Subject: RE: Using MYSQL and PHP With Vitual Apache Servers ?


In fact, I run 30 virtual servers, and 10 of them have their own databases
on the same MySQL  server.  I set up a different database for each one, and
give each one a username and password that only has access to each one, (I
even put a copy og phpMyAdmin on each site, configured to admin only that
database!)  Works great.

--Brian

-----Original Message-----
From: j.urban [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 06, 2002 7:44 AM
To: Matthew Darcy
Cc: [EMAIL PROTECTED]
Subject: Re: Using MYSQL and PHP With Vitual Apache Servers ?


Why not just create separate databases for each virtual server?  It sounds
like a perfect situation to create multiple databases, as databases do
provide data separation...

mysql> create database Virtual1;
mysql> create database Virtual2;
mysql> create database Virtual3;
mysql> create database Virtual4;

mysql> show databases;
+----------+
| Database |
+----------+
| Virtual1 |
| Virtual2 |
| Virtual3 |
| Virtual4 |
+----------+

And then in the PHP code for each website, you connect to the appropriate
database.

Say for website Virtual2:

$dbh = mysql_connect("localhost","user","pass");
mysql_select_db('Virtual2');

... Access schema for website Virtual2 ...


http://www.mysql.com/doc/C/R/CREATE_DATABASE.html
http://www.php.net/manual/en/function.mysql-select-db.php

Good luck.

On Sun, 6 Jan 2002, Matthew Darcy wrote:

> I have a redhat server, running apache 1.3.20. The server is running a
> couple of virtual servers for different websites. I now wish to add a few
> new virtual servers/domains to the machine. However (here is the twist)
> these sites will need to use a different mysql schema each and have some
of
> the content generated with php based on the data from the different mysql
> databases.
>
> Is this possible ??? if so what is needed to configure this setup (just
> brief), and I would be very interested in hearing from someone who is
> running virtual servers with each site using a different mysql database.
>
> Thanks,
>
> Matt.
>




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to