I went through several questions and recommendation to resolve the above issue, but No luck at all.
I have the following settings:
Windows Server 2008 R2
xampp-win32-1.8.2-5-VC9-installer
SQLSRV30 - php driver
sqlncli - Microsoft SQL Server 2008 R2 Native Client Set Up
I installed everything else and I have the following on the php.ini file The code below show where the php drivers are residing:
; On windows:
extension_dir="C:\xampp\php\ext"
The following is under windows extensions
extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll
When I check the phpinfo file sqlsrv is not listed. I know this may imply that its not installed, but It is installed.
The following is the php info file:
I also restarted apache and the server. Am I missing something ?
I get the following error:
Call to undefined function sqlsrv_connect()
This the code I am using to connect: I am connecting to another server which is hosting SQL Server 2005
/Connection to SQL Server Database
error_reporting(E_ALL);
$serverName = "172.xx.x.xxx";
$connectionInfo = array('Database'=>'Eque', "UID"=>"develop", "PWD"=>"develop");
$conn = sqlsrv_connect($serverName, $connectionInfo);
if($conn) {
echo "Connection established.<br />";
}else {
echo "Connection could not be established.<br />";
die(print_r(sqlsrv_errors(), true));
}
I have struggled through the process and this is what has finally worked. I am using php 5.4.16 and Apache 2.4.4 with Sql Express 2008 R2.
Download Microsoft Drivers for PHP for SQL Server from Microsoft download site
Extact the files to a local folder
Load the PHP drivers in php.ini file and restart the server.
extension=php_sqlsrv_53_ts.dll
extension=php_pdo_sqlsrv_53_ts.dll
Reference: http://technet.microsoft.com/en-us/library/cc296203(v=sql.105).aspx
TS denotes thread safe. find your server is thread safe or non thread safe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With