Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP 5.4 function_exists returns false for sqlsrv support

Posted on 2014-04-12
4
Medium Priority
?
574 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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

Expert Comment

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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

671 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