Forum Home
Press F1
 
Thread ID: 108189 2010-03-17 08:45:00 PHP MS SQL - Shouldn't this be working :S WarNox (8772) Press F1
Post ID Timestamp Content User
868096 2010-03-21 05:24:00 The file I pasted above was the current php.ini from C:\windows\, do you want me to upload it agian?

Ok changed the line as you asked and now the output is:

Have you installed http://sqlsrvphp.codeplex.com/ ?
somebody (208)
868097 2010-03-21 05:32:00 No I haven't installed that, wasn't aware that it was required?

Here is the link to download the current php.ini file.
www.mediafire.com
WarNox (8772)
868098 2010-03-21 08:30:00 No I haven't installed that, wasn't aware that it was required?

Here is the link to download the current php.ini file.
www.mediafire.com

I don't think PHP comes with the MSSQL drivers by default, so you have to install them separately. That would explain the "Fatal error: Call to undefined function mssql_connect()" message. This is just a guess, as I haven't had anything to do with PHP for a number of years...
somebody (208)
868099 2010-03-21 09:32:00 Ask the company you are hosting with, they should help you get it right. robbyp (2751)
868100 2010-03-21 09:47:00 I don't think PHP comes with the MSSQL drivers by default, so you have to install them separately. That would explain the "Fatal error: Call to undefined function mssql_connect()" message. This is just a guess, as I haven't had anything to do with PHP for a number of years...

Nope - the error is caused by the MS-SQL extension not being loaded. If the extension is present, but drivers are not, then you'll simply get connection errors when you try to use it. The function will still be there.
Erayd (23)
868101 2010-03-21 09:58:00 bool(false) bool(false)
Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\test\index.php on line 18
This indicates that the MS-SQL extension is not being loaded, despite the php.ini file you're using saying that it should be.

Please run the following code and post the output:
print_r(get_loaded_extensions(true));
var_dump(extension_loaded('mssql'));
print_r(get_extension_funcs('mssql'));

Please also run 'php -m' at the commandline, and post the output here. Note that you'll need to make sure that php.exe is in your PATH or in the current folder before running this.

What happens if you try to load the extension manually using dl()?
Erayd (23)
868102 2010-03-21 12:36:00 print_r(get_loaded_extensions(true));
var_dump(extension_loaded('mssql'));
print_r(get_extension_funcs('mssql'));


Array ( ) bool(false)
Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\test\index.php on line 19

---

php -m


C:\Documents and Settings\Administrator>php -m
[PHP Modules]
bcmath
calendar
com_dotnet
ctype
date
dom
filter
ftp
hash
iconv
json
libxml
odbc
pcre
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

---

I can try the dl() thing but not sure of the extensions name. Will figure that out tomorrow and post again, a bit late now :)
WarNox (8772)
868103 2010-03-21 13:32:00 OK, the MS-SQL extension definitely isn't loaded at all (in fact, you don't have any extensions loaded), despite your php.ini file specifying it.

Do you see any errors when starting PHP from the command line?

What happens when you try to load it with dl()?
Erayd (23)
868104 2010-03-21 19:01:00 Putting the following two lines (i assume this is the correct code) into the code:

dl('php_mssql.dll');
dl('php_pdo_mssql.dll');

gives the following:


Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=php_mssql.dll in your php.ini in C:\Inetpub\wwwroot\test\index.php on line 8

Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=php_pdo_mssql.dll in your php.ini in C:\Inetpub\wwwroot\test\index.php on line 9

Array ( ) bool(false)
Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\test\index.php on line 22


From php.ini

; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
enable_dl = On

---

Running 'php' in the command prompt seems ok!?


C:\Documents and Settings\Administrator>php
WarNox (8772)
868105 2010-03-21 20:46:00 Hmm - looks like you're using a SAPI that doesn't support dl() (generally means IIS or Apache embedded). Could you try running that same script from the CLI version please? Erayd (23)
1 2 3 4