phewett Posted March 11, 2009 Share Posted March 11, 2009 I have read a lot of posts today and tried a lot of solutions, but I seem to be stuck. I am running windows 2003 Server, IIS6, PHP 5 and MSSQL Server 2005. Allon the one server. when I try and access the database form PHP it fails with :- Fatal error: Call to undefined function mssql_connect() I have :- only one php.ini on my server in c:\php (attached as a txt) c:\php is in my path my php.ini has : extension_dir = "c:\php\ext" extension=php_mssql.dll the php_MSSQL.dll is in my c:\php\ext folder ntwdllib.dll is in c:\php I have tried moving both of these dlls to c:\windows\system but it makes no difference (even with a server restart) PHP config is attached Any ideas ? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/148894-cannot-connect-to-ms-sql-server/ Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 As you can see in your phpconfig output, the path to php.ini is set as C:\WINDOWS. Quote Link to comment https://forums.phpfreaks.com/topic/148894-cannot-connect-to-ms-sql-server/#findComment-781860 Share on other sites More sharing options...
phewett Posted March 14, 2009 Author Share Posted March 14, 2009 thanks mchl. I realise it says that but I assure you - there is no such file. Actually I have progressed somewhat with this problem. I discovered that php uses a "default" set of values if it is having trouble finding the correct php.ini. This is why it says php.ini is in c:\windows when there isn't one there - it's using the "default" values. a lot of the values in my "config" are different to my ini file for this very reason. So the problem was that php could not find my php using the path. I found advice on php.net that explains that you need ot set an environment variable called phprc and set its value to c:\php. I did that and it's now ready the right values out of my php.ini and the functions are loading. I'm still having trouble getting sql queries to work , but I'm don't know enough of what is wrong to post an update ! Quote Link to comment https://forums.phpfreaks.com/topic/148894-cannot-connect-to-ms-sql-server/#findComment-784302 Share on other sites More sharing options...
Mchl Posted March 14, 2009 Share Posted March 14, 2009 Some nice work on researching you did. You could just move your php.ini to c:\WINDOWS Anyway, does phpinfo show that mssql is loaded now? Quote Link to comment https://forums.phpfreaks.com/topic/148894-cannot-connect-to-ms-sql-server/#findComment-784434 Share on other sites More sharing options...
phewett Posted March 14, 2009 Author Share Posted March 14, 2009 indeed I could have - but I wouldn't have known why it worked ! ONce I created the PHPrc env var, it worked and yes mssql is loaded. I then had further problems - non of the mssql php functions would work. Again - found an answer at php.net - needed a later version of ntwdblib.dll. (I'm running SQL 2005 express) It's working now - but I have noclue about sQL - so need to educate myself So I'm "Solved" How do I make this thread as "solved" ? Quote Link to comment https://forums.phpfreaks.com/topic/148894-cannot-connect-to-ms-sql-server/#findComment-784874 Share on other sites More sharing options...
Mchl Posted March 14, 2009 Share Posted March 14, 2009 It should be somewhere next to "quote" I think... I never seem to remember exact location http://www.phpfreaks.com/forums/index.php/topic,118755.0.html Good work on figuring the stuff out BTW Quote Link to comment https://forums.phpfreaks.com/topic/148894-cannot-connect-to-ms-sql-server/#findComment-784893 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.