php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26988 Cannot connect to database while offline
Submitted: 2004-01-21 04:22 UTC Modified: 2004-01-21 06:07 UTC
From: david dot nordenberg at uppsala dot se Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.5RC1 OS: winxp sp1/mssql 2000 sp3
Private report: No CVE-ID: None
 [2004-01-21 04:22 UTC] david dot nordenberg at uppsala dot se
Description:
------------
I connect to a localy installed database trough the servername "localhost" which resolves to 127.0.0.1 which I can ping. Now if I pull my network cable, php loses the ability to connect to the database, no login attempts is registred by the sql server and php thinks the server does not exist. I can even change the servername value of mssql_connect to "127.0.0.1" but it still won't connect. Other applications can connect just fine to the sql server while not having any network interfaces up but not php, I think I saw the same problem with PHP 5 snapshot about a week old.

Reproduce code:
---------------
$server = "localhost";
$conn = mssql_connect($server, $_SESSION['login'], $_SESSION['passwd']);

Expected result:
----------------
mssql_connect to work

Actual result:
--------------
[client 127.0.0.1] PHP Warning:  mssql_connect() [<a href='function.mssql-connect'>function.mssql-connect</a>]: Unable to connect to server:  localhost in C:\Program\Apache Group\Apache2\htdocs\index.php on line 31, referer: http://localhost/

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-21 06:07 UTC] sniper@php.net
It's not PHP bug but some bug with the underlying DBLIB.
Make sure you have installed all the patches and latest MDAC components:

http://www.microsoft.com/data/
http://www.microsoft.com/sql

Also, read the various user comments found on page:

http://www.php.net/manual/en/function.mssql-connect.php


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 03:05:53 2022 UTC