newphpcoder Posted October 8, 2010 Share Posted October 8, 2010 Good day! After connecting my php to sql server 2005 using the mssql_connect() syntax, which did not work. I try my best that I can to work it, but at the end I could not fix the error. So now, I try another option like I used Microsoft Driver for SQL Server and the syntax that I’m using is sqlsrv_connect() Here are some configurations that I do to work the connection 1. I put the php folder in in C:\ 2. I configure my IIS 6.0 to run php using isapi 3. I installed the SQLSRV20.EXE inC:\php\ext 4. I configure my php.ini I uncommented the ff: extension_dir = "./ext" cgi.force_redirect = 0 doc_root = "C:\Inetpub\wwwroot" I add extension=php_sqlsrv_53_ts_vc9.dll I create a php file to test the connection <?php $server = "ISM\SQLEXPRESS"; $connectOptions = array("Database" => "dbtest"); //Because UID and PWD are not specified in the connection option //The connection is made with Windows Authentication. if($conn) { echo "Connection established"; } else { echo "Connection could not be established"; } ?> After I run this code I got an error like this: Fatal error: Call to undefined function sqlsrv_connect() in C:\Inetpub\wwwroot\testconn.php on line 5 I don’t know where is the problem and how can I fix it. I need to fix it as soon as possible, because almost 3 weeks I troubleshoot this connection. Any help is highly appreciated Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/215405-connection-from-php-to-sql-server-2005-database-using-sqlsrv_connect/ Share on other sites More sharing options...
Adam Posted October 8, 2010 Share Posted October 8, 2010 1. I put the php folder in in C:\ 2. I configure my IIS 6.0 to run php using isapi 3. I installed the SQLSRV20.EXE inC:\php\ext 4. I configure my php.ini I uncommented the ff: extension_dir = "./ext" cgi.force_redirect = 0 doc_root = "C:\Inetpub\wwwroot" I add extension=php_sqlsrv_53_ts_vc9.dll Did you restart the server after? Quote Link to comment https://forums.phpfreaks.com/topic/215405-connection-from-php-to-sql-server-2005-database-using-sqlsrv_connect/#findComment-1120118 Share on other sites More sharing options...
newphpcoder Posted October 11, 2010 Author Share Posted October 11, 2010 1. I put the php folder in in C:\ 2. I configure my IIS 6.0 to run php using isapi 3. I installed the SQLSRV20.EXE inC:\php\ext 4. I configure my php.ini I uncommented the ff: extension_dir = "./ext" cgi.force_redirect = 0 doc_root = "C:\Inetpub\wwwroot" I add extension=php_sqlsrv_53_ts_vc9.dll Did you restart the server after? Yes,after that configuration I restarted my server Quote Link to comment https://forums.phpfreaks.com/topic/215405-connection-from-php-to-sql-server-2005-database-using-sqlsrv_connect/#findComment-1120932 Share on other sites More sharing options...
miyakamoles Posted October 13, 2010 Share Posted October 13, 2010 What version of PHP are you running? You have specified the dll for 5.3 are you sure that is the version you are running? What php dll do you have in the PHP root folder (or run phpinfo)? Also in your sample you omitted showing your the line that makes the actual call. Can you include for us to help troubleshoot? I notice you didn't mention making sure you had this in your php.ini file: extension=php_pdo.dll That won't explain the undefined function call but will give you problems trying to connect. Quote Link to comment https://forums.phpfreaks.com/topic/215405-connection-from-php-to-sql-server-2005-database-using-sqlsrv_connect/#findComment-1121686 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.