LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache+php on one server and MySQL on onother server? (https://www.linuxquestions.org/questions/linux-newbie-8/apache-php-on-one-server-and-mysql-on-onother-server-219797/)

goe 08-19-2004 02:24 PM

Apache+php on one server and MySQL on another server?
 
Hi,

I'm using Fedora2 distribusion and I'm rather fresh in linux. Basiclly I'm trying to put Apache+php on one server and MySQL on onother server and make them talk to each onther.

I have two machines, both with Fedora2. One has apache+php and the other one MySQL database instaled. I have them in local network.

First server's IP is 192.168.3.20 (Apache + php)
Second server's IP is 192.168.3.21 (MySQL)

So instead calling "localhost" in php scripts hosted on first server I know I have to call second server IP (192.168.3.2) but my man question is how to configurate the second server to pass queries to MySQL DB and then send back results back to first server...?

Or maybe my thinking is wrong...
Please keep any answers simple to understand for newbie like me ;)

btmiller 08-19-2004 03:12 PM

When your first server calls mysql_connect from PHP with the proper arguments it will open a connection the the MySQL service on your second server, and all communication will be passed over this link, so there's nothing further to be done. Just make sure that your MySQL server is listening on port 3306 (and not just over a local socket) on the second machine.

Mara 08-19-2004 04:02 PM

mysql_connect ( '192.168.3.21:3306' , 'user', 'pass')
That's all. Change port (3306) if you're planning to use a different one.

david_ross 08-19-2004 04:25 PM

You will also need to make sure that the user you are trying to connect as, has permission to connect from the web server and not just the local to the sql server.


All times are GMT -5. The time now is 12:39 PM.