Jump to content

Recommended Posts

I am trying to get PHP to talk to MSSQL on a Windows 2003 server. I have this simple code on a page:

 

<?PHP

 

$link = mssql_connect('xxxxx', 'xx', 'xxxxx');

mssql_select_db('xxxxx', $link);

 

?>

 

and I am getting this error when I run the page.

 

Fatal error: Call to undefined function mssql_connect() in .php on line 3

 

I also tried this code to see if the functions are on:

 

<?

 

if (function_exists('mssql_fetch_row')) {

echo "MSSQL functions are available.<br />\n";

} else {

echo "MSSQL functions are not available.<br />\n";

}

 

?>

 

 

and that returns "MSSQL functions are not available".

 

I have made sure that the MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini. I also copied the ntwdblib.dll file into the \winnt\system32 directory. I have also rebooted numerous times.

 

Here is all the info about my setup:

 

Windows 2003 Server

MS SQL Server 2005

PHP 5.2.5

IIS 6.0

 

Any help on this would be great. I am very new to PHP and it is driving me crazy.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/99858-sql-functions-not-working/
Share on other sites

Where does it say your php.ini is located? Try:

<?php phpinfo(); ?>

 

I'm not sure if you're having the issue I'm thinking of, but depending on the PHP build, it could be looking for your INI in the wrong place.

 

On a side note, you REALLY don't want to use the MSSQL extension. Microsoft's driver hasn't been maintained in close to a decade and leaks memory badly. I suggest searching for code using the ADO interface or the ADOdb extension. Both are more modern and will give you less headache.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.