Question Locked

Accessing mysql database on a lan pc using php function

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi all,
i am using php at front end and mysql as dabase server. My problem is that i want to put my database server on another pc and access it through lan connection using php. Can anyone tell me what php function should i use and what parameters should be passed in it?

6 replies

by tony hopkinson

Two sides to this as far as the connection string goes, you just put the ip address/name of the new server in there.

What ever account the php is running under (apache or IIS ??) needs permission to access the mysql server, and it the webserver needs to be able to see it it on the network.

Nothing to do with php as such, except for pointing your connection at the relevant server.

by rickvill

I have two PC's namely PC1 and PC2.
PC1 has a program that runs myPhpAdmin using MySql as database.
these two PC's are connected via local network.
my Question: How can I set PC2 to connect to the program in PC1.
ive tried typing the ip address of PC1 on PC2 webbowser. it didnt work.
please help me.
thanks

by tony hopkinson

can PC2 hit PC1 as a webserver at all.

It should have a default web page (index.htm) or some such.
If you can't hit that from PC2, phpmyadmin is irrelevant.
If you can, then type in the full address of phpmyadmin's home page from PC1, on PC2, see what happens.
PHPMyadmin is just a set of web pages on PC1, if it's working on there it then where mysql is doesn't matter.
Your problem is PC2 can't see PC1 as a webserver, or PC2's user isn't allowed to use PHPAdmin.

by rickvill

PC2 can ping PC1.
In PC1, I just use http://localhost/rickvill .... rickvill here is just a file name.
when I try to typ PC1 ip address on PC 2's browser. it doesnt work.
What must I set first?

by rickvill

Thanks for the advise Mr. Hopkins Sir.
I just check the Windows Firewall and add port exception my program in PC1.
It works fine now. I can access it in PC2.
Thanks a lot sir.

This discussion is closed to new replies.