No
Main Topics
Browse All TopicsI Have a problem with a connection from PHP to SQL Server Express. Sometimes it functions and sometimes not.
I have php 5.2.5 with apache 2.2.3 on windows XP (Apache/2.2.3 (Win32) mod_ssl/2.2.3 OpenSSL/0.9.8d PHP/5.2.5). Windows XP has service pack 2
Windows XP runs on VMWARE FUSION.
I Try to connect to a SQLEXPRESS 2005 database server on localhost\SQLEXPRESS
If I try to connect the APACHESERVER crashes. In the Apache Error Log I see this error code:
"Parent: child process exited with status 3221225477 -- Restarting."
The version of NTWDBLIB.DLL is 2000.80.194.0
I made a testscript:
<?php
ini_set("display_errors","
echo 'Startscript' . '<br>';
$server = 'localhost\SQLEXPRESS';
//$server = 'dbserv';
$user = 'sa';
$pass = 'xxxxxxxx';
$db = 'HORA_DUNAMARE';
echo 'pre-connect' . '<br>';
ob_flush();
$mshandle = mssql_connect($server, $user, $pass) or die("Couldn't connect to SQL Server on ".$server." ".mssql_get_last_message()
echo 'post-connect' . '<br>';
ob_flush();
$selected = mssql_select_db($db, $mshandle) or die("Couldn't open database ".$db);
echo 'post-select' . '<br>';
ob_flush();
$query = mssql_query("SELECT TOP 10 * FROM AFDELING");
echo 'post-query' . '<br>';
ob_flush();
$data = mssql_fetch_array($query,M
echo 'pre-print' . '<br>';
echo '<pre>';
print_r($data);
echo '</pre>';
echo 'post-print' . '<br>';
?>
Sometimes it runs OK and sometimes it doesn't. If Apache has crashed and I restart Apache and try to run this testscript it fails. But if I, after a restart of Apache, run the script first with a false password and after that with the right password it runs again.
Can someone shed some light on this strange behavior
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: RQuadlingPosted on 2009-09-01 at 16:06:21ID: 25237032
Basically, don't use mssql_xxxx. Use either the ODBC route or the new http://www.microsoft.com/s qlserver/2 005/en/us/ PHP- Driver .aspx
ferences/w ebcasts (Connecting PHP to Microsoft Technologies I think it was).
NTWDBLIB is ancient and unsupported.
Microsoft are in the process of getting a PDO version of their driver.
Download the recent php|Architect webcast on this at http://www.phparch.com/con