473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Connection to MS SQL Server has stopped working

I made all the necessary changes to my server (windows 2k3 r2) in
order to get my php page to read from my MS SQL (v6.5) server (on
another machine). I was able to pull data down last night with no
problem. Today, however, I get nothing. The server I'm pulling from
is up and has no errors. If I change the login/password for the
connection string to something wrong, I don't get an error message.
In fact, the page is blank as if there was an error within the code
(this is regardless of whether I use a correct or incorrect login).
Yesterday when it was working, if I used the wrong login, I got the
usual error message back. If I comment out all the lines regarding
the connection, it builds the table just fine.

I've attached my code below (stripped out some table columns and data
manipulation code).

I have copied ntwlibd.dll to my windows\system32\ directory and
enabled the "extension=php_mssql.dll" line in my php.ini file.

If anyone has seen this before or has any suggestions, please let me
know... this is quite frustrating.

Thanks,
Jason

================================================== ===

<?php

$con = mssql_connect('server', 'login', 'password');
if (!$con)
{
die('Could not connect: ' . mssql_error());
}

mssql_select_db("CM", $con);

$sql="SELECT *FROM Private_Build";

$result = mssql_query($sql);

echo "<table border='1'>
<tr>
<COL width='100'>
<th bgcolor='black' style ='color:white'>Patch ID</th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Packages'] . "</td>";
echo "</tr>";
}
echo "</table>";

mssql_close($con);
?>

Apr 19 '07 #1
8 4269
On Apr 19, 9:32 am, sank.hate.s...@gmail.com wrote:
I made all the necessary changes to my server (windows 2k3 r2) in
order to get my php page to read from my MS SQL (v6.5) server (on
another machine). I was able to pull data down last night with no
problem. Today, however, I get nothing. The server I'm pulling from
is up and has no errors. If I change the login/password for the
connection string to something wrong, I don't get an error message.
In fact, the page is blank as if there was an error within the code
(this is regardless of whether I use a correct or incorrect login).
Yesterday when it was working, if I used the wrong login, I got the
usual error message back. If I comment out all the lines regarding
the connection, it builds the table just fine.

I've attached my code below (stripped out some table columns and data
manipulation code).

I have copied ntwlibd.dll to my windows\system32\ directory and
enabled the "extension=php_mssql.dll" line in my php.ini file.

If anyone has seen this before or has any suggestions, please let me
know... this is quite frustrating.

Thanks,
Jason

================================================== ===

<?php

$con = mssql_connect('server', 'login', 'password');
if (!$con)
{
die('Could not connect: ' . mssql_error());
}

mssql_select_db("CM", $con);

$sql="SELECT *FROM Private_Build";

$result = mssql_query($sql);

echo "<table border='1'>
<tr>
<COL width='100'>
<th bgcolor='black' style ='color:white'>Patch ID</th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Packages'] . "</td>";
echo "</tr>";
}
echo "</table>";

mssql_close($con);
?>
Turn on display_errors so you can see why the page isn't coming up.

Apr 19 '07 #2
Turn on display_errors so you can see why the page isn't coming up.

I did like you suggested and got the following error in my browser:

Fatal error: Call to undefined function mssql_connect() in C:
\Documents and Settings\Administrator\Desktop\testSiteFiles\php
\buildInfoGet.php on line 8

Again, I'm just amazed that I'm getting this when I didn't have a
problem last night.

Any ideas?

Thanks,
Jason

Apr 19 '07 #3
look up mssql_connect and look at the requirements. it must either be
compiled into php or enabled as a dll (which is set in your php.ini...and
must reside in your include_path).
<sa************@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
|Turn on display_errors so you can see why the page isn't coming up.
|
| I did like you suggested and got the following error in my browser:
|
| Fatal error: Call to undefined function mssql_connect() in C:
| \Documents and Settings\Administrator\Desktop\testSiteFiles\php
| \buildInfoGet.php on line 8
|
| Again, I'm just amazed that I'm getting this when I didn't have a
| problem last night.
|
| Any ideas?
|
| Thanks,
| Jason
|
Apr 19 '07 #4
On Apr 19, 12:59 pm, "Steve" <no....@example.comwrote:
look up mssql_connect and look at the requirements. it must either be
compiled into php or enabled as a dll (which is set in your php.ini...and
must reside in your include_path).
I've been search for hours and have come up with nothing that works.
I have done the following:

- uncommented the extension=php_mssql.dll
- made sure my ext directory path was correct
- copied ntwdlib.dll to both my system32 and PHP directory
- PHP is in my system path
- PHPRC has been setup as an environment variable
- MSVCR71.DLL has been copied to my PHP dir (supposedly ntwdlib.dll
relies on it)

I also added the following bit of code to the top of the page:

if(extension_loaded("mssql")) {
echo "MSSQL is Loaded<br />";
}
else {
echo "MSSQL not loaded<br />";
}

When you load the page, it now says "MSSQL not loaded"

Just for an update, PHP is installed on a new Windows Server 2003 R2
Standard Edition box with IIS and I'm trying to connect to an older
server running Microsoft SQL Server 6.5.

Thanks,
Jason

Apr 19 '07 #5
On Apr 19, 1:51 pm, sank.hate.s...@gmail.com wrote:
On Apr 19, 12:59 pm, "Steve" <no....@example.comwrote:
look up mssql_connect and look at the requirements. it must either be
compiled into php or enabled as a dll (which is set in your php.ini...and
must reside in your include_path).

I've been search for hours and have come up with nothing that works.
I have done the following:

- uncommented the extension=php_mssql.dll
- made sure my ext directory path was correct
- copied ntwdlib.dll to both my system32 and PHP directory
- PHP is in my system path
- PHPRC has been setup as an environment variable
- MSVCR71.DLL has been copied to my PHP dir (supposedly ntwdlib.dll
relies on it)
After you did all that did you restart IIS?

Apr 19 '07 #6
Fixed it.

I had copied the new ntwdlib.dll from the internet and installed it,
but didn't do an IIS reset... so when it was working, it pulled from
the old file that was loaded. So after it had some time to refresh,
it pulled from the newer version and broke. I extracted the
ntwdlib.dll that came with PHP 5.2.1, copied it into the PHP and
system32 directories, and the page came back up.

So if anyone reading this is trying to connect to a really old SQL
server and having my problem... use the old ntwdlib.dll.

Thanks all for your help!

Jason

Apr 19 '07 #7

"ZeldorBlat" <ze********@gmail.comwrote in message
news:11**********************@b75g2000hsg.googlegr oups.com...
| On Apr 19, 1:51 pm, sank.hate.s...@gmail.com wrote:
| On Apr 19, 12:59 pm, "Steve" <no....@example.comwrote:
| >
| look up mssql_connect and look at the requirements. it must either be
| compiled into php or enabled as a dll (which is set in your
php.ini...and
| must reside in your include_path).
| >
| I've been search for hours and have come up with nothing that works.
| I have done the following:
| >
| - uncommented the extension=php_mssql.dll
| - made sure my ext directory path was correct
| - copied ntwdlib.dll to both my system32 and PHP directory
| - PHP is in my system path
| - PHPRC has been setup as an environment variable
| - MSVCR71.DLL has been copied to my PHP dir (supposedly ntwdlib.dll
| relies on it)
| >
|
| After you did all that did you restart IIS?

also, display errors. it may be that php needs permissions to access the
directory and dll...esp. if it is being run as a cgi (which it usually is on
windows).
Apr 19 '07 #8

<sa************@gmail.comwrote in message
news:11**********************@l77g2000hsb.googlegr oups.com...
| Fixed it.
|
| I had copied the new ntwdlib.dll from the internet and installed it,
| but didn't do an IIS reset... so when it was working, it pulled from
| the old file that was loaded. So after it had some time to refresh,
| it pulled from the newer version and broke. I extracted the
| ntwdlib.dll that came with PHP 5.2.1, copied it into the PHP and
| system32 directories, and the page came back up.
|
| So if anyone reading this is trying to connect to a really old SQL
| server and having my problem... use the old ntwdlib.dll.
|
| Thanks all for your help!

awesome. glad you got it working.
Apr 19 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ernest | last post by:
Hello I think that I'm having a problem with a damaged table, but I'm not sure. First of all, I'm using the following: -Suse 9.0 (Kernel 2.4.21-192) -MySQL 4.0.15 -PHP 4.3.3 -Apache 1.3.28
0
by: Steve Barker | last post by:
Hi guys, I've written an application in C# that connects to a Paradox table via ODBC. My code has always worked fine, but now I've moved my application to another machine, it's stopped working!...
1
by: mdurliSPAMFILTER | last post by:
Hello, I developed a win32 .exe CGI that connects to a clustered SQLServer to report some data. The software is written with Borland C++Builder. This is the oledb string:...
4
by: yop | last post by:
All I need to store a connection in the application object due to the need to use MYSQL and its very poor connection pooling. Would someone have an example as the code below is not working...
1
by: GSK | last post by:
This one has me stumped: I am using HttpWebRequest to resolve an external URL (that outputs an XML string). It works fine on my dev machine (W2K), and used to work on my production machine...
1
by: Bob | last post by:
I had code to use connection strings using integrated windows security and that's been working OK for years, Now in my testing environment ( a W2k server and 4 computers on a small LAN all with...
9
by: Bill E. | last post by:
I'm creating an MS Access application that connects to a SQL Server 2005 database using pass-through queries and ADO to call stored procedures. I ran a SQL trace and started clicking through...
3
by: Bill E. | last post by:
Rick, That's almost like asking why we should bother with database connection pooling. It's a question of efficient use of resources and avoiding problems that may occur in production. I was...
1
by: mikerudy | last post by:
I have an 3rd-party application that uses a SQL back-end, but uses Access 2000 (linked tables all using the same DSN) as an intermediary. We recently upgraded from SQL 7 to SQL 2005, which went...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.