Solved

PHP 5.4 function_exists returns false for sqlsrv support

Posted on 2014-04-12
4
573 Views
Last Modified: 2014-04-12
The question is: Is there a way in PHP that I can call via a loop that shows me all the available database drivers loaded and list the driver string I would use to cause function_exists to return true?


I'm trying to create a database and configure support for it using an open source calendar program I downloaded.  The installer runs an if/else structure to see what databases are loaded in PHP for me to select from a combo box to supply it with credentials to the database (SQLExpress in my case).  I read that in version 5.4 the mssql_connect is no longer available and to DL and use the latest from Microsoft SQLSRV.exe.  I have loaded the php_sqlsrv_54_nts.dll in the extensions folder and added it into the PHP.INI file.  resetiis

PHPInfo shows sqlsrv is enabled. However, running the code below shows no love on the driver.  testing for 'odbc' and 'mysqli' return ok.  Am I missing something on the new driver here?

My php.ini has:
[ExtensionList]
extension=php_sqlsrv.dll
extension=php_sqlsrv_54_nts.dll

and I've restarted IIS8.

<?php

  if (function_exists ( 'sqlsrv' )) {
    echo "SQL is loaded" ;
  }
  else
  {
        echo "No Love from SQL" ;
        }
?>

output: No Love from SQL
0
Comment
Question by:davebird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39996356
Try 'sqlsrv_connect' instead of just 'sqlsrv'.  SQLSRV is the name of the class but not the name of a specific function.
0
 

Author Comment

by:davebird
ID: 39996368
Thank you!  That resolved.  Any code that would loop and show me all available drivers loaded?
0
 

Author Closing Comment

by:davebird
ID: 39996377
Sorry. You answered my question.  Thank you!!
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39996399
You're welcome, glad to help.
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question