Welcome Guest, Not a member yet? Register   Sign In
sqlsrv_connect() problem
#1

I'm trying to get CI3 connecting to SQL server on a Windows 2012 R2 box.

I get the same error whether I use the sqlsrv or mssql driver specification in the database.php file.
The error complains that sql_connect or mssql_connect is undefined in the sql_driver.php file (or mssql_driver.php)

Has anyone come across this problem?
Reply
#2

It sounds like you need to install the PHP sqlsrv driver. Documentation for installation/configuration is at http://php.net/manual/en/book.sqlsrv.php
Reply
#3

Thanks mrwhitney, but I have the latest Microsoft PHP driver for SQL installed. Whether it is in the right place is another matter as the docs say put it in the extensions folder php/extensions but it is actually named /ext.
Reply
#4

If sqlsrv_connect is not defined, the Microsoft driver is either not installed or not loading properly. The function is provided by the Microsoft driver.

The same goes for mssql_connect, except that it is a command provided by a completely different driver which is not available in more recent versions of PHP anyway.

Microsoft's documentation for the sqlsrv driver includes information on configuring it to load when PHP starts and confirming that it is loading properly in your environment: https://msdn.microsoft.com/en-us/library...05%29.aspx
Reply
#5

Hello,

I had same problem with following configuration,  

* Windows 8, 64bit
* SQLSRV30.exe ( which is containing SQL Server php DLL files )
*sqlncli.msi
* WAMP with 64 bit & PHP 5.5
* CodeIgniter 3.0.4
* SQL Server 2012 standard ( & Tested SQL Server 2014 express too )

and I fixed it with following configuration

* Remove WAMP 64 bit & Install 32 bit WAMP
* Install sqlncli.msi
* extract SQLSRV30.exe in somewhere in your pc
* in SQLSRV30 extracted files, find & copy php_sqlsrv_55_ts.dll  & php_pdo_sqlsrv_55_ts.dll in to WAMP\bin\PHP5.5.12\ext\
*register that 2 files into php.ini files which is in WAMP\bin\PHP5.5.12\
*Fully close WAMP & re-open again ( don't restart service , fully close from system tray right click/ exit )

It's solved my problem, it caused because of SQL server PHP drivers not running on 64 bit WAMP.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB