PHP help question

PHP help question

am 13.02.2008 16:52:42 von Rudy sleiman

To whom it may concern

I'm working on a network, i don't have internet access and the
application i'm working on is not published online.

Platform used: PHP with MySQL.

The Database is created on PC A... I'm working on PC B... and my
problem is that i am not able to connect to the PC A Database using
the IP address as a host (since the database is not on my machine).
but if i'm on PC A i can connect with the localhost.

The question is that: do i need any configuration so i can access the database?

Waiting for your reply

Regards,
Rudy.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: PHP help question

am 13.02.2008 17:28:34 von MIGUEL ANTONIO GUIRAO AGUILAR

Chances are that the port on PC A is blocked for the DB service. Or that
your DB server has been configured to not to accepp connections ffrom =
the
outside.

__________________
Miguel Guirao Aguilera, Linux+, ITIL
Sistemas de Informaci=F3n
Inform=E1tica R8
Ext. 7540
--> -----Original Message-----
--> From: Rudy sleiman [mailto:rudy.sleiman@gmail.com]
--> Sent: Mi=E9rcoles, 13 de Febrero de 2008 09:53 a.m.
--> To: php-db@lists.php.net
--> Subject: [PHP-DB] PHP help question
-->=20
--> To whom it may concern
-->=20
--> I'm working on a network, i don't have internet access and the
--> application i'm working on is not published online.
-->=20
--> Platform used: PHP with MySQL.
-->=20
--> The Database is created on PC A... I'm working on PC B... and my
--> problem is that i am not able to connect to the PC A Database using
--> the IP address as a host (since the database is not on my machine).
--> but if i'm on PC A i can connect with the localhost.
-->=20
--> The question is that: do i need any configuration so i can access =
the
--> database?
-->=20
--> Waiting for your reply
-->=20
--> Regards,
--> Rudy.
-->=20
--> --
--> PHP Database Mailing List (http://www.php.net/)
--> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP help question

am 13.02.2008 17:30:12 von newsletter

Rudy sleiman wrote:
> To whom it may concern
>
> I'm working on a network, i don't have internet access and the
> application i'm working on is not published online.
>
> Platform used: PHP with MySQL.
>
> The Database is created on PC A... I'm working on PC B... and my
> problem is that i am not able to connect to the PC A Database using
> the IP address as a host (since the database is not on my machine).
> but if i'm on PC A i can connect with the localhost.
>
> The question is that: do i need any configuration so i can access the database?


Add the ip adress and virtual hostname in your hosts file

like :

192.168.5.2 mysql

and you can in your mysql connect string, write 'mysql', and the ip is
the ip to the pc containing the database

the hosts file is located on a linux machine

/etc/hosts

on a windws (correct me if im wrong)
c:/windows/system32/drivers/etc/hosts

Kind regard
Hasse R. Hansen, Denmark

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: PHP help question

am 13.02.2008 17:32:27 von MIGUEL ANTONIO GUIRAO AGUILAR

Chances are that the port on PC A is blocked for the DB service. Or that
your DB server has been configured to not to accepp connections ffrom =
the
outside.

__________________
Miguel Guirao Aguilera, Linux+, ITIL
Sistemas de Informaci=F3n
Inform=E1tica R8
Ext. 7540
--> -----Original Message-----
--> From: Rudy sleiman [mailto:rudy.sleiman@gmail.com]
--> Sent: Mi=E9rcoles, 13 de Febrero de 2008 09:53 a.m.
--> To: php-db@lists.php.net
--> Subject: [PHP-DB] PHP help question
-->=20
--> To whom it may concern
-->=20
--> I'm working on a network, i don't have internet access and the
--> application i'm working on is not published online.
-->=20
--> Platform used: PHP with MySQL.
-->=20
--> The Database is created on PC A... I'm working on PC B... and my
--> problem is that i am not able to connect to the PC A Database using
--> the IP address as a host (since the database is not on my machine).
--> but if i'm on PC A i can connect with the localhost.
-->=20
--> The question is that: do i need any configuration so i can access =
the
--> database?
-->=20
--> Waiting for your reply
-->=20
--> Regards,
--> Rudy.
-->=20
--> --
--> PHP Database Mailing List (http://www.php.net/)
--> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: PHP help question

am 13.02.2008 17:58:28 von Matthias Willerich

> The Database is created on PC A... I'm working on PC B... and my
> problem is that i am not able to connect to the PC A Database using
> the IP address as a host (since the database is not on my machine).
> but if i'm on PC A i can connect with the localhost.
>
> The question is that: do i need any configuration so i can access the
> database?

First things first: This has nothing to do with PHP itself, it's just a
configuration issue.

You need to check the following things: Is your configuration on PC B set up
to the right IP (as host), db, username and password? On PC A, what host is
associated with the user? If it's localhost, it won't work. I think that you
can set up the same user for localhost and any host with different
passwords, make sure that's not the case (or that you have the right
password on PC B). Finally, do any firewalls on PC B or PC A or other
network constraints let the communication through?

This is all fairly basic, but I hope it helps.

Cheers,
Matthias

--
Matthias Willerich
http://www.contentwithstyle.co.uk

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: PHP help question

am 13.02.2008 18:10:15 von MIGUEL ANTONIO GUIRAO AGUILAR

Chances are that the port on PC A is blocked for the DB service. Or that
your DB server has been configured to not to accepp connections ffrom =
the
outside.

__________________
Miguel Guirao Aguilera, Linux+, ITIL
Sistemas de Informaci=F3n
Inform=E1tica R8
Ext. 7540
--> -----Original Message-----
--> From: Rudy sleiman [mailto:rudy.sleiman@gmail.com]
--> Sent: Mi=E9rcoles, 13 de Febrero de 2008 09:53 a.m.
--> To: php-db@lists.php.net
--> Subject: [PHP-DB] PHP help question
-->=20
--> To whom it may concern
-->=20
--> I'm working on a network, i don't have internet access and the
--> application i'm working on is not published online.
-->=20
--> Platform used: PHP with MySQL.
-->=20
--> The Database is created on PC A... I'm working on PC B... and my
--> problem is that i am not able to connect to the PC A Database using
--> the IP address as a host (since the database is not on my machine).
--> but if i'm on PC A i can connect with the localhost.
-->=20
--> The question is that: do i need any configuration so i can access =
the
--> database?
-->=20
--> Waiting for your reply
-->=20
--> Regards,
--> Rudy.
-->=20
--> --
--> PHP Database Mailing List (http://www.php.net/)
--> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: PHP help question

am 13.02.2008 19:33:43 von parasane

On Feb 13, 2008 10:52 AM, Rudy sleiman wrote:
> To whom it may concern
>
> I'm working on a network, i don't have internet access and the
> application i'm working on is not published online.
>
> Platform used: PHP with MySQL.
>
> The Database is created on PC A... I'm working on PC B... and my
> problem is that i am not able to connect to the PC A Database using
> the IP address as a host (since the database is not on my machine).
> but if i'm on PC A i can connect with the localhost.
>
> The question is that: do i need any configuration so i can access the database?

What error message is being kicked out by PHP when you do
mysql_connect() or mysql_query() with an `or die(mysql_error())`
condition?

Ensure that the firewall is allowing remote connections to port
3306 on PC A. If it is, then the problem is likely in the MySQL
internal permissions. If that's the case, do the following
(substituting your info in place).

As root (or another authorized user of the database you want to use):
USE database_name;
GRANT ALL ON database_name TO database_username@'%' IDENTIFIED
BY 'zxcvbnm';
FLUSH PRIVELEGES;

Replace database_name with the name of your database; replace
database_username with a username of your choice (doesn't have to be
an existing account, MySQL will create it on the fly); replace '%'
with the hostname/IP of PC B (using single-quotes around it) or leave
it as '%' (with the quotes) to allow ALL hosts (wildcard); replace
'zxcvbnm' (with quotes) with a password of your choice.

--


Daniel P. Brown
Senior Unix Geek


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php