alexmetal Posted October 10, 2008 Share Posted October 10, 2008 After a couple years of not writing any PHP, I've come back to it to make a time clock system for my company. Instead of installing MySQL, I decided to use our SQL server. It's SQL Server 2005 running on Windows Server 2003. PHP 5 and Apache 2.2.0 are installed on a Windows XP Pro SP3 machine. When trying to connect to the server (either using sqlsvr_connect() or mssql_connect(), I don't get anything. I don't get an error. Just a blank page. Any ideas? Here's the code: function sqlCon() { $serv = "CSNSVR01\CSNSVR01"; $con_prop = array("UID"=>"user","PWD"=>"pass","DATABASE"=>"CSNTC"); $con = sqlsvr_connect($serv,$con_prop); if (!$con) { die(print_r(sqlsrv_errors(),true)); } echo "Connection successful."; sqlsvr_close($con); } Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/ Share on other sites More sharing options...
IchBin Posted October 10, 2008 Share Posted October 10, 2008 You should probably take a read on this page mate. http://us3.php.net/manual/en/function.mssql-connect.php What the hell is up with the captcha for posting? .... Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662298 Share on other sites More sharing options...
alexmetal Posted October 10, 2008 Author Share Posted October 10, 2008 I've tried mssql_connect too. Same thing, no error, just a blank page. Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662308 Share on other sites More sharing options...
PFMaBiSmAd Posted October 10, 2008 Share Posted October 10, 2008 A blank page is either the result of a parse error or a fatal runtime error (or code that simply does not output anything.) Have you checked your web server error log and/or turned on full php error reporting to see what errors are occurring? Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662312 Share on other sites More sharing options...
alexmetal Posted October 10, 2008 Author Share Posted October 10, 2008 I'm getting this in Apache: (didn't even think to look) PHP Warning: PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_mssql.dll' - The specified module could not be found.\r\n in Unknown on line 0 How should extension_dir: be configured in php.ini? I have is as "C:\php\ext\", isn't that right? I made sure php_mssql.dll is in the directory, too. Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662316 Share on other sites More sharing options...
PFMaBiSmAd Posted October 10, 2008 Share Posted October 10, 2008 mssql requires an auxiliary .dll file called - ntwdblib.dll This file must be in a folder that is on the Windows PATH statement. This file is normally in the main php folder. The best way to get this and other extensions that use auxiliary .dll files to work is to add the main php folder to the Windows PATH statement (reboot your computer to get any change made to the Windows PATH statement to take effect.) Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662329 Share on other sites More sharing options...
alexmetal Posted October 10, 2008 Author Share Posted October 10, 2008 That was it. I remember reading that about two hours ago, and just started getting so frustrated with it I completely forgot about it. Thank you so much. Now I just have to figure out why it won't connect. Haha. Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662342 Share on other sites More sharing options...
alexmetal Posted October 10, 2008 Author Share Posted October 10, 2008 The final step is to add a registry key on the PHP server. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo (If the ConnectTo key doesn't exist, create it) The create a new string value DSQUERY and put DBNETLIB for the data. Link to comment https://forums.phpfreaks.com/topic/127915-solved-cant-get-microsoft-sql-server-driver-or-mssql-to-work/#findComment-662348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.