requirements for loading php mssql extension?

jmoriarty
jmoriarty used Ask the Experts™
on
Hey folks,

I'm having some trouble loading the php mssql extension. For some reason, despite uncommenting the extension in php.ini, it refuses to load. I can load other modules fine, both custom and built in extensions, my php install is working flawlessly otherwise, etc so I'm guessing there's some other requirement needed for loading that extension?

Server setup is Win7 X64 / IIS / PHP 5.3.1 installed as FastCGI / SQL Server 2005

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
You'll need to copy the ntwdblib.dll file into your system32 directory. You can get that file from the SQL server itself - it's often in the system32 directory on the server that has SQL server installed.

Author

Commented:
Sorry, I should've specified, I already did put ntwdblib.dll in system32. Also, just for the sake of argument, I reinstalled php with a fresh php.ini file, and it works fine -- up until the point I enable mssql extension, then I get a HTTP 500 error:

HTTP Error 500.0 - Internal Server Error
C:\PHP\php-cgi.exe - The FastCGI process exited unexpectedly

if I comment out the mssql extension, works fine again.


Thanks for your help in any case.

Commented:
Have you enabled logging in your php.ini file?
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
As silly as it sounds, I'd forgotten after the reinstall. The error getting written to syslog now is:

php[3016]
PHP Warning:  PHP Startup: Unable to load dynamic library './php_mssql.dll' - The specified module could not be found.
 in Unknown on line 0

The file is definitely there though, so has to be something else - or a version conflict of some sorts, but the mssql.dll is from the same distro as the installed version, so shouldn't be that I wouldn't think.

Commented:
Have you set the extension dir properly? I think that the default PHP install puts all those DLLs into an "ext" subdirectory, and usually you have to modify the php.ini file to add "ext" to the extension_dir.

Author

Commented:
Yeah, extension dir's set right. I confirmed it by enabling/disabling openssl extension a couple of times then running phpinfo(); after each to ensure it was loaded/unloaded, etc.
Commented:
Another thing to try is to install the Process Monitor from Microsoft. It should show you everything that's happening on your hard drive (and a LOT more). Run the tool and get a capture going and then restart your server so you can trigger that error. As soon as the error happens, stop the Process Monitor capture and search through to try to find out if the server can't find a file.

Note - the Process Monitor will usually capture a LOT of data really quickly. It's easy to end up with tens of thousands of records, so it helps to have a starting point. If you have ntwdblib installed in your system32 directory, then I would at least search the records for that, and then use that information to look for other possible problems.

Author

Commented:
Great idea, and led me down the right path I think. In Process Mon, I was watching the php-cgi.exe loading extensions fine, but would never even attempt to load the mssql one, then I happened upon this:

http://social.msdn.microsoft.com/Forums/en-US/sqldriverforphp/thread/55268c68-9d37-4b0f-ad0e-4213bad1d182

which sounds like it may be the root of my problem. Sounds like a downgrade of php install may be in order.

Author

Commented:
Yah, that was it. Working fine now. Guess a code upgrade's in order before the next PHP version.

Thanks for the help!

Commented:
I thought mssql extension was no longer supported in 5.3.x? And that you need to use the extension Microsoft is working on...

Did you get the mssql extension working for 5.3.X in the end??

Author

Commented:
No, I didn't - you're correct; 5.3 dropped support for that extension. A downgrade of our PHP install was the quick fix.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial