[BNM] [bnm] SQL Server and other conundra

Nick Taylor nick at tangerineworks.com
Mon Apr 16 20:50:18 BST 2007



It seems to be random - though now I'm usinmg pconnect it's also fairly 
rare.

I'd thought about doing the die->newlink thing... but when it was 
failing to connect, it was doing so so frequently that this wouldn't 
have been much more successful I don't think. I seem to recall it 
failing first time... then 5-20 goes later it will work.

When I cruise around google looking for clues etc, most seem to think 
there's a dll that might be out of date.

As this bit of code is used as an administrative thing I can live with 
it failing to connect about 1/100 (which is what it's doing now)

Thanks for your help




Nick



> Ok... caching, threads, leaks...
> 
> Is there a pattern in the success/failure -- specifically does the first
> call (after a reboot/restart) always work (or always fail)? or is it random?
> If it always works first time, then it may be that PHP is keeping the
> connection (and returning it later) but it has become corrupted in some
> way, or MSSQL might have closed it for some reason. I don't know how/where
> PHP caches these connectios so can't actually suggest a solution for that...
> 
> Maybe change the 'die' to open with 'newlink' set to true, and only die if
> that fails too? Or keep _pconnect as a permanent solution...
> 
> Regards
> 
> Paul /)/+)
> 
> On 16/04/07, Nick Taylor <nick at tangerineworks.com> wrote:
>>
>>
>> hmm... mssql_pconnect seems to work fairly reliably.
>>
>>
>>
>>> Like you say - hard to diagnose without good info...
>>>
>>> As it does connect sometimes, syntax and security seem to be ruled out
>> as
>>> problems.
>>>
>>> First thing to work out is whether it is PHP not asking for the
>> connection,
>>> or SQL not providing it. I'd start by looking at the log files on the
>> SQL
>>> server for clues (if you can see lots of failed connections the reason
>> may
>>> be obvious); if you can only see good connections then it maybe the PHP
>> side
>>> of things, or the network itself (any chance you are flooding the
>> network?).
>>> To check the network I would be thinking about running a packet sniffer
>>> (there are some good 'free trials' out there), if that doesn't give an
>>> answer, but points at PHP (i.e. connection requests not showing on the
>>> network) then maybe think about a reinstall.
>>>
>>> Maybe point the PHP to a different instance of SQL Server as another way
>> of
>>> checking where the problem is; and/or running the PHP on another box and
>>> pointing that at the existing SQL Server - if things are different in
>> any of
>>> these cases, then you should have an indication of where you really need
>> to
>>> be looking.
>>>
>>> Regards
>>>
>>> Paul /)/+)
>>>
>>> On 16/04/07, Nick Taylor <nick at tangerineworks.com> wrote:
>>>>
>>>>
>>>>> Nick Taylor <nick at tangerineworks.com> wrote:
>>>>>
>>>>>> Ok, one for all you techie chaps out there...
>>>>>>
>>>>>>
>>>>>> How come when I try to connect to a sql server db with PHP via IIS
>>>> using
>>>>>> this...
>>>>>>
>>>>>> $s=mssql_connect('localhost', 'user', 'pwd')  or die("Couldn't
>> connect
>>>>>> to SQL Server on ".'localhost');
>>>>>>
>>>>>> [...]
>>>>> What's the connection like with Management Studio? I don't know
>> anything
>>>> about
>>>>> PHP but you can eliminate a few things with that.
>>>> I think it's ok - if that's the thing that my client uses... I
>>>> personally don't have access to anything except ftp and the relevent
>>>> passwords etc.
>>>>
>>>> It's like trying to communicate with an alien via morse code. In the
>> dark.
>>>> --
>>>>
>>>> BNM Subscribe/Unsubscribe:
>>>> http://lists.wessexnetworks.com/cgi-bin/mailman/options/bnmlist/
>>>> BNM info/archives:
>>>> http://www.brightonnewmedia.org/
>>>>
>>>> BNM archive search:
>>>> http://www.roddis.org/bnm/search.php
>>>>
>>>> BNM powered by Wessex Networks:
>>>> http://www.wessexnetworks.com
>>>>
>> --
>>
>> BNM Subscribe/Unsubscribe:
>> http://lists.wessexnetworks.com/cgi-bin/mailman/options/bnmlist/
>> BNM info/archives:
>> http://www.brightonnewmedia.org/
>>
>> BNM archive search:
>> http://www.roddis.org/bnm/search.php
>>
>> BNM powered by Wessex Networks:
>> http://www.wessexnetworks.com
>>



More information about the BNMlist mailing list. Powered by Wessex Networks