ColinP Posted March 18, 2010 Share Posted March 18, 2010 Hello, I'm setting up PHP on a server that's been working with ASP and MSSQL (I usually work with *nix environments). I installed PHP using the installer from the website. I checked the 'MSSQL' extention in the installer to make sure it installed that too. php_mssql.dll is in the ext folder PHP.ini is in /Windows/ php_mssql.dll is added as an extention in the loaded PHP.ini file. phpinfo(); confirms that php.ini is loading from the right place. Here's the configure line from phpinfo if that helps: cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--without-pi3web" "--enable-mongo=shared" There's no sign of the word "mssql" in the phpinfo() I found out that a DLL 'ntwdblib.dll' was needed in the windows path. It wasn't there, or anywhere else on the system, so I put it in /Windows/, /Windows/system32/ , and the PHP path (/Program Files/PHP5 & /ext) for safe measure. Rebooted the server and web server, still no luck. PHP is working fine apart from this. The following code: if (function_exists('mssql_connect')) { echo "function exists"; } else { echo "function doesn't exit."; } outputs function doesn't exit. and this code: $link = mssql_connect($hostname, $db_username, $db_password); returns PHP Fatal error: Call to undefined function mssql_connect() in C:\inetpub\wwwroot\db_open.php on line 7 Any help would be greatly appreciated as I am well and truely stumped. Quote Link to comment https://forums.phpfreaks.com/topic/195698-cant-get-mssql-to-work-with-php/ Share on other sites More sharing options...
ColinP Posted March 18, 2010 Author Share Posted March 18, 2010 I've found a bit of a work around so this is sort of resolved. I downloaded the Microsoft SQL Server Driver for PHP (quick google seach will find the .dll in an executable with further instructions), placed it in the extensions directory and added it to php.ini. After restarting the web server, I'm now able to use sqlsrv_ functions (such as sqlsrv_connect() - they're not the same syntax as mssql_connect etc however, so you can't just plug and play this into an old application. mssql_ functions are still not working - but at least I can connect to MSSQL through PHP now. Quote Link to comment https://forums.phpfreaks.com/topic/195698-cant-get-mssql-to-work-with-php/#findComment-1028200 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.