PHP Localhost Application connect to server database

Posted by Cross Vander on Stack Overflow See other posts from Stack Overflow or by Cross Vander
Published on 2012-11-14T04:52:56Z Indexed on 2012/11/14 4:59 UTC
Read the original article Hit count: 125

Filed under:
|
|
|

I want to ask about how to connect my localhost application (C:xampp/htdocs/myproject) to database at my server host (www.someweb.somedomain)?

Am I possible to do that? If it is, how to connect it at my php config? Right now my config (server.php) is:

<?php
    $host = "my web IP public:3306";
    $user = "root";
    $pass = "";
    $db = "dispatcherDB";

    $conn = mysql_connect($host, $user, $pass) or die ("Cant connect to mySQL");
    mysql_select_db($db);
?>

what I got:

Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\XMS\server.php on line 7

So, what must I filled for $host? I'm trying using website IP, it still can't connect. Maybe there's someone here have experience at this problem?

Sorry for my bad English

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql