473,385 Members | 2,069 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,385 software developers and data experts.

mssql_connect not defined on MS Windows w/ IIS

Hello

I have problems connecting to my MSSQL through php.

I have a microsoft windows server 2003, web edition with php5 installed and Microsoft SQL Server: SQL Server 2005 Express Edition as my platform.

my connection string is as follows:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     $conn = mssql_connect('212.97.133.11','baconso_flemming','mypassword');
  3.     mssql_select_db('Baconso_flemming',$conn);
  4. ?>
  5.  
I get the following error message:

Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\connopenphp.inc on line 2

I have done all the usual things that has to be done in order to get mssql to work with php such as removing the ';' from the extension=php_mssql.dll in my php.ini file.

I have downloaded the proper version of ntwdblib.dll (vers. 2000.80.194.0) and copied certain files to windows/system32 directory such as the ntwdblib.dll file and the php_mssql.dll file.

When i run a little file i made called info.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. phpinfo();
  4.  
  5. ?>
  6.  
I can't see any information about mssql in the description that appears on the screen.

I also did another little file:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (function_exists('mssql_query')) {
  3.     echo "MSSQL functions are available.<br />\n";
  4. } else {
  5.     echo "MSSQL functions are not available.<br />\n";
  6. }
  7. ?>
it returned: MSSQL functions are not available.

Can anyone help me get my connection to work???????

Any ideas are more than welcome.........
May 24 '07 #1
13 7772
tolkienarda
316 100+
what php install are you using WAMP, some IIS install or is it on an apache web server

here is what i always use

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $host="localhost"; // Host name.
  3. $db_user="user"; // MySQL username.
  4. $db_password="pass"; // MySQL password.
  5. $database="dbname"; // Database name.
  6. $ambi = mysql_pconnect($host, $db_user, $db_password) or trigger_error(mysql_error(),E_USER_ERROR);
  7. ?>
  8.  
and i always use that then on the page i call that from i use the

Expand|Select|Wrap|Line Numbers
  1. <?
  2.  include 'connect.php';
  3.  mysql_select_db($database, $ambi);
  4.  ?>
  5.  
eric
May 24 '07 #2
I do not use apache server. I use the built in IIS version 6. In php i selected IIS ISAPI module when installing.

I tried your code suggestion, but it was the same.
May 24 '07 #3
Motoma
3,237 Expert 2GB
Did you try starting the IIS service after making the changed to php.ini?

Have you gotten any error messages from IIS?

Is php loading the proper .ini file?
May 24 '07 #4
I have tried restarting the IIS service after making changes to the php file.

I haven't gotten any error messages from the IIS,only the error message before mentioned.

I am loding the file php.ini
May 24 '07 #5
Motoma
3,237 Expert 2GB
What I meant was this: modify a value in php.ini that is coming up correctly in phpinfo() and check to see if that change was reflected in phpinfo(). If not, you may have your path incorrectly set.
May 24 '07 #6
Motoma
3,237 Expert 2GB
what php install are you using WAMP, some IIS install or is it on an apache web server

here is what i always use

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $host="localhost"; // Host name.
  3. $db_user="user"; // MySQL username.
  4. $db_password="pass"; // MySQL password.
  5. $database="dbname"; // Database name.
  6. $ambi = mysql_pconnect($host, $db_user, $db_password) or trigger_error(mysql_error(),E_USER_ERROR);
  7. ?>
  8.  
and i always use that then on the page i call that from i use the

Expand|Select|Wrap|Line Numbers
  1. <?
  2.  include 'connect.php';
  3.  mysql_select_db($database, $ambi);
  4.  ?>
  5.  
eric
This will not help because the OP is trying to use MSSQL instead of MySQL.
May 24 '07 #7
I have to .ini files. One named php.ini-dist and an other named php.ini-recommended.

Tried changing something in both of them, but the change didn't appear in the info.php file. Strange!

Any idea why this occurs......................?
May 24 '07 #8
Motoma
3,237 Expert 2GB
I have to .ini files. One named php.ini-dist and an other named php.ini-recommended.

Tried changing something in both of them, but the change didn't appear in the info.php file. Strange!

Any idea why this occurs......................?
Because you are not changing php.ini which happens to be the file PHP is looking for.
You need to read through the PHP installation instructions to find out how to set up the config file and the system paths.
May 25 '07 #9
pbmods
5,821 Expert 4TB
Changed thread title to better match thread contents.
May 25 '07 #10
that did it........

Thanks a lot.......
May 25 '07 #11
Motoma
3,237 Expert 2GB
that did it........

Thanks a lot.......
Awesome. Glad to help out.
May 25 '07 #12
Hope someone can give me a bit of advice here. We had a wonderfully working implemention of php / mssql / windows 2003. Following patch Tuesday the php scripts can no longer talk to the database. Much googling has not gleaned a result, apart from taking away the I am alone with this problem feeling. Apparently removing service pack 2 will fix the problem. Any better suggestions ?
Jul 26 '07 #13
Purple
404 Expert 256MB
Hi osmosis and welcome to TSDN !

for info you should post this in a new thread..

I am running a number of server 2003 with sp2 installed and php 5, mssql with IIS 6 - have not experienced any issues with the service pack

I suggest you open a new thread and we can discuss further.

Regards Purple
Jul 26 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Håvard Olerud Eriksen | last post by:
I'm trying to connect to MSSQL server 2000 using IIS 6.0. The only way I've been able to connect, however, is by disabling anonymous access and setting mssql.secure_connection = On. If I try to...
4
by: Biffo | last post by:
I have PHP Version 5.0.3 installed on Windows XP Pro with IIS as the webserver. All is working well, except I get a - Fatal error: Call to undefined function mssql_connect() in...
2
by: elsC | last post by:
Bonjour, Je viens d'installer SQL Server 2000 Dev edition. J'ai créé des connexions sécurisées SQL Server et pourtant lorsque j'essaie de me connecter avec PHP (mssql_connect('localhost',...
2
by: David Haynes | last post by:
I can't seem to get the magic to work to connect to SQL Server via mssql_connect(). I can get odbc_connect to work just fine, but not mssql_connect. Could someone please post an example of how the...
6
by: spamguy21 | last post by:
I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000 running. Individually, each works great. When trying to bring PHP and MSSQL together, though, I'm tearing my hair out...it just...
12
by: aryan2cool | last post by:
hii i have faced a fatel error like.."Fatal error: Call to undefined function: mssql_connect() in c:\winnt\temp\tmphrivp8.php on line 7" i am using php with plone in windows xp pro.. any...
4
by: aryan2cool | last post by:
hii all i am using php 5 and a warning has occured in my application " Warning: mssql_connect() : message: Login failed for user 'PAYDATA'. (severity 14) in C:\WINNT\Temp\tmpqjqokj.php on...
2
by: mirali00 | last post by:
Hello, This is a strange one! I'm getting blank results for mssql_connect. I created a simple testmssql.php page with the following code: <?php if (function_exists('mssql_connect')) {...
3
Ciary
by: Ciary | last post by:
hi all, i've encountered a new problem. i was trying to connect to a ms sql server (9.0) to connect i use this: mssql_connect("***.***.***.***","User","userpw"); and i got this error:...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.