Re: PDO Connection problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Fri, Jan 10, 2014 at 10:13 AM, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx>wrote:

> History:
> I'm trying to help a friend who is hosting his domain with the same
> company that I use.  I've been using this company for several years and
> have used a certain 'connection' script all the time.  Part of it looks
> like this:
> $host=";dbname=$sc_dbname;charset=utf8";
> $uid = "uid";
> $pswd = "pswd";
> Try
> {
>         $mysql = new PDO($host,$uid,$pswd,$db_options);
> }
> .....
> So - when I tried to provide this template to my friend (who is new to all
> of this) we went thru days of emails trying to make sure everything was
> setup correctly but could never get a connection using the above code.
>  Finally last night, after reviewing how my 'old' mysql interface
> connection worked, I experimented with the above changing my host= from my
> domain name to simply 'localhost'.  Voila - it worked for him.  It also
> worked for my site.
> Here's my question:  What would make by friend's account not work when
> referencing a true domain name in the host= attribute?  I'm assuming that
> our (shared) provider is setting up his many accounts & servers the same
> way, but I could be wrong.  And of course, I don't have a clue about what
> makes any of this work - I simply follow instructions/guidance I get from
> manuals and searches until I get things to work.  That's how I got his
> account to finally work, but I'd love to have an idea why it now does.
> --
> PHP Database Mailing List (
> To unsubscribe, visit:
It could be that your MySQL configs -bind-address and skip-networking are
set, so it is not allowing for external connections. My guess (could be
wrong) that using is the same as making an external call, as
opposed to using localhost (no DNS lookup).

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux