From:             kugel at rci dot rutgers dot edu
Operating system: 
PHP version:      5.2.12
PHP Bug Type:     Feature/Change Request
Bug description:  mysql_connect can't resolve hostname within apache module

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 bug report at http://bugs.php.net/?id=51147&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51147&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51147&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51147&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51147&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51147&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51147&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51147&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51147&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51147&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51147&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51147&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51147&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51147&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51147&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51147&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51147&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51147&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51147&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51147&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51147&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51147&r=mysqlcfg

Reply via email to