mysql and apache on different machines

wuboy

Member
Feb 28, 2002
59
0
0
Hi folks,

I've got a question regarding a setup that I have going at work.
I want to put apache on one machine, and I want MySQL on another.
Of course, I will be installing php and ssl on the web server, so those wont be issues. But I also want to install the mod_auth_mysql, so that might have some complaints...

So I have two questions:

1. How would I make connectivity between the two boxes? I'd have to open up port 3306 for MySQL, and then store the DB on the MySQL box? Do I specify this in the PHP code when I run queries?

2. If I want to use mod_auth_mysql, I'll have to do the queries off the mysql box also, so I'd have to specify it somewhere in the apache module, I believe. Is there any way to do this?

Sorry, I think that was more than 2 questions. Hope someone can help me out.

Thanks.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Ok, I've never used mod_auth_mysql, so I can't help you there, and I'm just starting to learn some PHP, so take my comments with some salt :)

With PHP it should be as easy as specifying the database server in the connect call. For instance:

With MySQL server on the local machine:
mysql_pconnect("localhost", "apache", "")

For a MySQL server located on a remote machine called dbserv:
mysql_pconnect("dbserv", "apache", "")

In the database, be sure to set up a account for the user that apach runs as, and make sure it's allowed to connect from the web server machine.