Req #51147 [Opn->Fbk]: mysql_connect can't resolve hostname within apache module
| From: | andrey@php.net | Date: | Tue, 11 May 2010 10:46:50 +0000 |
| Subject: | Req #51147 [Opn->Fbk]: mysql_connect can't resolve hostname within apache module | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150326@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51147&edit=1
ID: 51147
Updated by: andrey@php.net
Reported by: kugel at rci dot rutgers dot edu
Summary: mysql_connect can't resolve hostname within apache module
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: MySQL related
PHP Version: 5.2.12
New Comment:
Operating system?
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/bug.php?id=51147&edit=1