By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

mssql_connect blank

P: 1

This is a strange one! I'm getting blank results for mssql_connect. I created a simple testmssql.php page with the following code:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (function_exists('mssql_connect')) {
  3. die("Your PHP installation does not have MSSQL support.");
  4. }
  6. echo "Connecting...";
  7. echo "<BR>";
  9. $hostname = "ServerName";
  10. $username = "UserName";
  11. $password = "pwd";
  13. $db = mssql_connect ($hostname, $username, $password);
  15. if ($db){
  16. echo "no connection";
  17. }else{
  18. echo "connected";
  19. }
  21. ?>
Here's the strange part:
1) I get a blank respone for mssql_connect function
2) Even, stranger, if I shut down IIS, this works like a charm!!

My Environment:
PHP (Installed C:\Program Files\PHP)
IIS 6.0 (Windows Server 2003)
.php configured to ""C:\Program Files\PHP\php-cgi.exe", All Verbs, Script Engine checked.

Any ideas?


Troubleshooting Step:
I removed the @ from @mssql_connect and I get the following error:
PHP Fatal error: Call to undefined function mssql_connect() in ..... line 15.
Oct 25 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,584
Get linux or get Apache. Dropping IIS will save you lots of headaches in the future as well.
Oct 28 '08 #2

Expert 5K+
P: 6,050
I believe your logic is flawed: function_exists() returns true or false depending on whether the function exists - just as the name implies. You, however, check if the function exists and if it does you kill the script! Maybe that's not the problem, because you should get errors either way.

Using PHP on IIS never seemed logical to me: this is M$ we're talking about, and when have they ever catered to others needs?
Oct 28 '08 #3

Post your reply

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