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
868086 2010-03-17 20:03:00 The firewall is off and disabling NOD didn't achieve anything. WarNox (8772)
868087 2010-03-17 20:04:00 Yeah using mssql for PHPBB too but that connects through system dsn (odbc). WarNox (8772)
868088 2010-03-17 22:43:00 What you see above is all I have, but the code doesn't seem to get past:


$dbhandle = mssql_connect('localhost', 'sa', 'xxyyxxyy');
if (!$dbhandle){
echo "Couldn't connect to SQL Server on $myServer";
}


---

I will try setting the actual hostname or IP and let you know how that goes.

That's not what I meant - I was referring to your actual error_reporting mask, as set via either an in-scope php.ini, ini_set(), or the error_reporting() function.

If you don't know, put this line at the top of your file:
error_reporting(E_ALL|E_STRICT);

To check that the mssql extension is really loaded, add this:
var_dump(is_function('mssql_connect'));

If those don't tell you what's wrong, could you please pastebin any php.ini files you're using, plus a phpinfo dump?

Edit: Just as a random impertinent side-question, is there a reason why you're not using PDO for this?
Erayd (23)
868089 2010-03-18 00:54:00 Erayd:

Im not sure how to use PDOs, yet, so thats why :)

Putting either one of those two lines doesn't do anything, one of them seems to kill the page (nothing at all is displayed - var_dump(is_function('mssql_connect'));) and the other one doesn't display anything.

Alright here are the files you requested:
www.mediafire.com
www.mediafire.com

Hope thats what you need.

Thanks again.
WarNox (8772)
868090 2010-03-18 02:53:00 Do these lines need to be set?

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysqli.default_user =
Orca (3098)
868091 2010-03-18 03:23:00 Thats for MYsql and I'm using MSsql :) WarNox (8772)
868092 2010-03-19 03:02:00 OK - first up, where's the rest of your phpinfo output? It should look something like this (drop.erayd.net).

If your phpinfo output is in fact listing all the loaded modules, then you have a problem with your PHP configuration - it's not loading the mssql module.

In your php.ini file, change the 'display_errors' setting to 'on' - note that this setting should not be used on a production server, but it will make your life a lot easier during development.

The error reporting line I gave you above doesn't output anything on its own, but it makes PHP start obsessing over every little thing that goes wrong - combined with the ini setting in this post, it should result in some decent error output that will help determine what is wrong.

The other line should definitely be outputting something (it should be displaying a boolean) - can you try running this and let me know the result?
var_dump(false);
var_dump(is_function('mssql_connect'));
Erayd (23)
868093 2010-03-19 04:34:00 Sorry, messed that up, here's the phpinfo().

warnox.ath.cx

---

I've enabled this on the PHP.ini file and restarted the server, inserted the two lines:


var_dump(false);
var_dump(is_function('mssql_connect'));

to the top of index.php and this is the output:


bool(false)
Fatal error: Call to undefined function is_function() in C:\Inetpub\wwwroot\test\index.php on line 9
WarNox (8772)
868094 2010-03-19 09:04:00 Oops - my mistake. Try this:
var_dump(function_exists('mssql_connect'));

Could you please pastebin the current version of the file 'C:\WINDOWS\php.ini' - for some reason you don't appear to have the MS-SQL extension loaded, despite enabling it in the file you posted before.

Was the file you posted before C:\WINDOWS\php.ini, or something else?
Erayd (23)
868095 2010-03-21 05:17: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:


bool(false) bool(false)
Fatal error: Call to undefined function mssql_connect() in C:\Inetpub\wwwroot\test\index.php on line 18
WarNox (8772)
1 2 3 4