rfr1tz
asked on
How to configure PHP & MySQL so that Apache+PHP in one Linux server can work with MySQP at another Linux server
Hi,
Assumed that Apache+PHP are installed in a server (private IP Address: 192.168.0.3) and MySQL is installed in another Linux server (private IP address: 192.168.2.5). What I should do to configure PHP and MySQL so that they can work with each other (the same as when we install all of them in only Linux server)?
Thanks a lot for your help,
rfr1tz
Assumed that Apache+PHP are installed in a server (private IP Address: 192.168.0.3) and MySQL is installed in another Linux server (private IP address: 192.168.2.5). What I should do to configure PHP and MySQL so that they can work with each other (the same as when we install all of them in only Linux server)?
Thanks a lot for your help,
rfr1tz
ASKER
Hi VGR,
Thanks a lot for your reply. I think you've put out very good details on MySQL sides. For Apache+PHP side, I've a question: how Apache+PHP knows that it should send any communication with MySQL to the server with IP address: 182.168.2.5 and don't look to anywhere else? Should I need to set something about IP Address and port number for database connection on Apache+PHP?
Thanks,
rfr1tz
Thanks a lot for your reply. I think you've put out very good details on MySQL sides. For Apache+PHP side, I've a question: how Apache+PHP knows that it should send any communication with MySQL to the server with IP address: 182.168.2.5 and don't look to anywhere else? Should I need to set something about IP Address and port number for database connection on Apache+PHP?
Thanks,
rfr1tz
yes, that exactly what "$linkID=mysql_connect('19 2.168.1.2' ,"$dbLogin ","$dbPass word") or die ("bad connect".mysql_error());" is about 8-)
It is the PHP (as an Apache module or not) code to access a remote MySql DB on the host '192.*' with user/pw
with a simple GRANT *.* ON ... on the MySql side (flush privileges too, see dox) you should be on in a minute 8-)
It is the PHP (as an Apache module or not) code to access a remote MySql DB on the host '192.*' with user/pw
with a simple GRANT *.* ON ... on the MySql side (flush privileges too, see dox) you should be on in a minute 8-)
ASKER
Hi VGR,
Thanks a lot for details you've put out. Because I'm pretty new to both Apache+PHP and MySQL, may you give more details about how to set $linkID; for example, which system file I need to set this or can I do it via GUI (KDE). The same for mysql_select_db, $query="[snip].
For $query=..., I see only 1 quote, do we need another quote at the end?
On MySQL side, do I need to do anything else besides successfully starting MySQL so that MySQL accepts commands and requests from Server #1? For example, do I need to set MySQL needs to listen to any port or any connection, etc?
Thanks a lot for your help and sorry if the questions are trivial,
rfr1tz
Thanks a lot for details you've put out. Because I'm pretty new to both Apache+PHP and MySQL, may you give more details about how to set $linkID; for example, which system file I need to set this or can I do it via GUI (KDE). The same for mysql_select_db, $query="[snip].
For $query=..., I see only 1 quote, do we need another quote at the end?
On MySQL side, do I need to do anything else besides successfully starting MySQL so that MySQL accepts commands and requests from Server #1? For example, do I need to set MySQL needs to listen to any port or any connection, etc?
Thanks a lot for your help and sorry if the questions are trivial,
rfr1tz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just make sure your MySql server (mysqld) accepts commands and requests from host#1 (Apache+PHP)
And set up your MySql connections to use IP@ of the MySql server, like this :
$linkID=mysql_connect('192
mysql_select_db($dbName,$l
$query=" [snip]
basically, it's just a rights/IP@/login/password thing to check. Should be easy.