Link to home
Start Free TrialLog in
Avatar of ats2012
ats2012

asked on

Unable to load PHP MSSQL support using Microsoft Drivers for PHP for SQL Server

I am running PHP 5.3.13 and loaded the file php_sqlsrv_53_nts.dll using the file from this download.

http://www.microsoft.com/en-us/download/details.aspx?id=20098

When I try to run the below code I get the error:

Fatal error: Call to undefined function sqlsrv_connect() in E:\wamp\www\sandbox\sql\index.php on line 9

<?php
error_reporting(E_ALL);

$serverName = "IP Address";

$connectionOptions = array("Database"=>"Name");


$conn = sqlsrv_connect( $serverName, $connectionOptions);

if( $conn === false )

die( FormatErrors( sqlsrv_errors() ) );
?>

Open in new window


Anyonw have any ideas how to get this working? I am running this on Server 2008 R2. Thanks
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Avatar of ats2012
ats2012

ASKER

I went through all this already and still no luck.
Avatar of gr8gonzo
1. Create a phpinfo() script and make sure that it's reading the php.ini file that you're expecting it to read.

2. What does your extension section of that php.ini file look like?
Avatar of ats2012

ASKER

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
; 
extension=php_sqlsrv_53_nts.dll




;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
extension=php_ldap.dll
;extension=php_ming.dll
;extension=php_mssql.nts.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll      
;extension=php_oci8_11g.dll 
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_phar.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll

Open in new window

Avatar of ats2012

ASKER

That is the file that its reading located here:

E:\wamp\bin\apache\apache2.2.22\bin\php.ini
Did you install the current version of SQL Native Client?  It is required by 'sqlsrv'.  If your SQL Server is on the same machine as the web server with PHP, then it was installed with the SQL Server.  If not, you have to download and install it yourself.  It's in the middle of this page: http://www.microsoft.com/en-us/download/details.aspx?id=29065
Avatar of ats2012

ASKER

Yes. I did that also.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial