NYCPHP Meetup

NYPHP.org

[nycphp-talk] can connect to MySQL from command line, but not from script

David Mintz david at davidmintz.org
Tue Nov 20 15:30:18 EST 2007


I just installed CentOS 5 and I need to connect to a MySQL server on
another box. I can do it from the command line but not from PHP. These
old scripts use PEAR DB. Thus:

mysql -utestuser -psecret -hinterps2 test

Your MySQL connection id is 20491 to server version: 5.0.17-standard-log
mysql>

But:
<?php
require 'DB.php';
$DSN = "mysqli://testuser:secret@interps2/test" ;
$db = DB::connect($DSN);

if (PEAR::isError($db)) {
   echo $db->getDebugInfo();
} else {
   echo "alleluyah\n" ;
}

Output:

[nativecode=Can't connect to MySQL server on 'interps2' (13)] **
mysqli://testuser:secret@interps2/test

I wish to hell it would tell me why not. Anyone have any ideas where
to look for more information?

Thanks,

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness



More information about the talk mailing list