Page 1 of 1

php newbie: mssql problem

Posted: Sun Jun 15, 2003 10:27 am
by paul_r
hellO! i'm trying to connect to my ms sql server. i tried mssql_connect( "localhost", "", "" );

but i get an error saying:
Fatal error: Call to undefined function: mssql_connect() in c:\inetpub\wwwroot\db.php on line 6

i read something in your site about how to fix this but i can't seem to understand the instructions. I think it said that i should add something to the php.ini file and compile php...

i'm new to php. can you give me more detailed instructions in solving this. thanks!

Posted: Sun Jun 15, 2003 3:44 pm
by delorian
Start from here:

http://pl.php.net/manual/en/ref.mssql.php

and read the user notes. There's one you will find very interesting :]

Posted: Sun Jun 15, 2003 6:57 pm
by paul_r
i'm sorry. i couldn't find anything similar in the link you gave me. i'm using windows xp pro with iis and i have php 4.3.2. I'm also using microsoft sql server 2000. it works fine with asp.net. In the link you gave me, most were for unix/linux. how do i make php recognize the mssql functions?

Posted: Mon Jun 16, 2003 5:22 am
by cactus
Do you have the client libraries on the machine where your are running PHP ?

If not, you will need to read the man page "delorian" posted before, it explains how to setup the client and implement the changes needed in the php.ini etc.
Requirements for WIn32 platforms.

The extension requires the MS SQL Client Tools to be installed on the system where PHP is installed. The Client Tools can be installed from the MS SQL Server CD or by copying ntwdblib.dll from \winnt\system32 on the server to \winnt\system32 on the PHP box. Copying ntwdblib.dll will only provide access. Configuration of the client will require installation of all the tools.
Regards,

Posted: Tue Jun 17, 2003 10:03 pm
by paul_r
i got the mssql functions working. now i just need to get the later version of the ntwdblib.dll. I can't connect to my mssql server. I found a link for the .dll file in the page debian gave me but i can't open it. I can't find any on the web. The one on my sql cd is only about 260kb. I believe that there's one greater than 300kb, right? could you give another link? thanks!

Posted: Tue Jun 17, 2003 10:20 pm
by paul_r
by the way, these are the errors i receive:

Warning: mssql_connect(): Unable to connect to server: 127.0.0.1:1433 in c:\inetpub\wwwroot\db.php on line 6

Warning: mssql_close(): supplied argument is not a valid MS SQL-Link resource in c:\inetpub\wwwroot\db.php on line 7

this is my db.php file:

<html>
<body>

<?php
$link = mssql_connect( "127.0.0.1:1433", "Paul Rivera", "" );
mssql_close( $link );
?>

</body>
</html>

i'm using the local account. my windows username is Paul Rivera and i don't have any password. i tried using localhost instead of 127.0.0.1 but still nothing happened. I have also tried putting other ports/ even no ports specified... nothing.