php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13738 cant connect to external db with dns name
Submitted: 2001-10-18 10:56 UTC Modified: 2002-05-24 20:15 UTC
From: sliljedahl at ad-c dot com Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.0.6 OS: Win 2000 server
Private report: No CVE-ID: None
 [2001-10-18 10:56 UTC] sliljedahl at ad-c dot com
I am running php 4.0.6 on IIS 5 on a windows 2000 server
My database runs ms sql 2000 on a windows 2000 server seperate machine from the web server.

my dns is set so that my database machine is named labdb and its ip address in 192.168.0.63

when I execute
function ConnectToDatabase()
{
	$dbname   = "is5sql";
	$dbserver = "labdb";

	if(!mssql_connect($dbserver, "interscale", "")){
		return FALSE;
	}
	
	if(!mssql_select_db($dbname)){
		return FALSE;
	}

	return TRUE;
}
I get an error that I cannot connect to the database.

when i execute:
function ConnectToDatabase()
{
	$dbname   = "is5sql";
	$dbserver = "192.168.0.63";

	if(!mssql_connect($dbserver, "interscale", "")){
		return FALSE;
	}
	
	if(!mssql_select_db($dbname)){
		return FALSE;
	}

	return TRUE;
}
this connects to the database and returns true.
I can connect to the database server with the dns name if i use ADO, but not if i use the php_mssql.dll.

can this be fixed?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-19 07:36 UTC] sander@php.net
Are you sure that your DNS is configure properly?
Try to ping to labdb (just enter "ping labdb" (without the quotes) in a dos-prompt). 
It's likely to be a problem with your DNS-setup.
 [2001-10-19 09:05 UTC] sliljedahl at ad-c dot com
I can ping it just fine.

C:\WINDOWS>ping labdb

Pinging labdb [192.168.0.63] with 32 bytes of data:

Reply from 192.168.0.63: bytes=32 time=1ms TTL=128
Reply from 192.168.0.63: bytes=32 time<10ms TTL=128
Reply from 192.168.0.63: bytes=32 time<10ms TTL=128
Reply from 192.168.0.63: bytes=32 time<10ms TTL=128

Ping statistics for 192.168.0.63:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum =  1ms, Average =  0ms

I can connect to the database using Visual Basic Apps, with either the name or the IP address, it is just the php that cant seem to resolve the name when connecting to the database.
 [2002-05-24 20:15 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jun 26 22:01:26 2019 UTC