PHP + Remote MySql connection question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mukul_chou
Forum Newbie
Posts: 5
Joined: Tue Jun 17, 2008 4:23 am

PHP + Remote MySql connection question

Post by mukul_chou »

I have been told that to connect a MySql database through php the MySql server has to be physically installed on the same server as the apache. Is it true? A little bit of search indicates not. I came to know php can connect to MySql through TCP/IP and socket. Tcp/ip is default. For socket connection I came to know MySql server has to be physically installed on the same server as the apache [ref. phpMyAdmin documentation]. What about tcp/ip? A real test consisting different physical server will resolve the matter for sure. But availing 2 physical server (/pc) is bit difficult for me.
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: PHP + Remote MySql connection question

Post by WebbieDave »

mukul_chou wrote:I have been told that to connect a MySql database through php the MySql server has to be physically installed on the same server as the apache. Is it true?
No. In fact, the first parameter to the mysql_connect function is the server name.
Post Reply