Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-19-2004, 02:24 PM   #1
LQ Newbie
Registered: Aug 2004
Location: Boston, US
Distribution: Fedora2
Posts: 1

Rep: Reputation: 0
Question Apache+php on one server and MySQL on another server?


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 (Apache + php)
Second server's IP is (MySQL)

So instead calling "localhost" in php scripts hosted on first server I know I have to call second server IP ( 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

Last edited by goe; 08-19-2004 at 02:40 PM.
Old 08-19-2004, 03:12 PM   #2
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
Old 08-19-2004, 04:02 PM   #3
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
mysql_connect ( '' , 'user', 'pass')
That's all. Change port (3306) if you're planning to use a different one.
Old 08-19-2004, 04:25 PM   #4
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MYSQL Server + Apache Server + PHP gabriellai Linux - Networking 7 05-26-2005 12:03 PM
how do i Know Apache PHP MYSQL Installed on my Dedicated Server? phpsharma Linux - Newbie 3 04-18-2005 05:40 PM
PHP/MySQL and Apache server setup nenyo Linux - Software 7 02-12-2005 01:48 PM
Dreamweaver, PHP, MySQL, and Apache Web server bentman78 Linux - Software 18 02-06-2005 05:09 AM
Installing PHP and MySQL w/ Apache web server dcrealm47 Linux - Newbie 5 02-26-2003 11:21 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:33 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration