Edit report at https://bugs.php.net/bug.php?id=51147&edit=1
ID: 51147 Updated by: u...@php.net Reported by: kugel at rci dot rutgers dot edu Summary: mysql_connect can't resolve hostname within apache module -Status: Feedback +Status: Bogus Type: Feature/Change Request Package: MySQL related PHP Version: 5.2.12 Assigned To: mysql Block user comment: N Private report: N New Comment: There are no IP checks in libmysql. Previous Comments: ------------------------------------------------------------------------ [2010-05-11 12:55:04] paj...@php.net Fedora 11 host, Apache/2.2.13 (Fedora) (from the report) ------------------------------------------------------------------------ [2010-05-11 12:46:50] and...@php.net Operating system? ------------------------------------------------------------------------ [2010-02-25 18:25:20] kugel at rci dot rutgers dot edu Description: ------------ When this is run from the command line: "php mytest.php" on the local machine, it connects successfully to the remote database. When it's run as a webpage, it dies with the mysql_error message of "Unknown MySQL server host 'mysql.vobj.org' (2)" Command line access "mysql -h mysql.vobj.org ..." works fine. If I substitute the IP address for the hostname, the webpage connects. NOTE: vobj.org is hosted by dreamhost, and while mysql.vobj.org maps to 67.205.28.132, 67.205.28.132 maps to thadison.masevo.dreamhost.com. Maybe there's some IP security check that causes failure without generating a useful error message. Fedora 11 host, Apache/2.2.13 (Fedora) Reproduce code: --------------- <?php # $host='67.205.28.132'; $host='mysql.vobj.org'; $database='bugdemo'; $dbuser='bugdemo'; $pw='PHPisGreat'; $link = mysql_connect($host,$dbuser,$pw) or die('Could not connect: ' . mysql_error() ); mysql_select_db($database) or die('Could not select database '.$database); echo "successful connection<br />\n"; mysql_close($link); ?> Expected result: ---------------- Code should say "successful connection<br />\n" Actual result: -------------- Could not connect: MySQL server host 'mysql.vobj.org' (2) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=51147&edit=1