0

I can connect Mssql Server using SQL Management Studio. But I need to connect to Mssql server from PHP, Apache Server. What should I do?

I just try this codes.

    <?php
    $serverName = "192.168.2.100\\sqlexpress"; //serverName\instanceName
    // Since UID and PWD are not specified in the $connectionInfo array,
    // The connection will be attempted using Windows Authentication.
    $connectionInfo = array( "Database"=>"RGD_MAKNA_2019T", "UID"=>"RGD", "PWD"=>"123RGD");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    if($conn) {
         echo "Connection established.<br />";
    }else{
         echo "Connection could not be established.<br />";

    }
    ?>

it gives me this

errror:"sqlsrv_connect is not function"

theduck
  • 2,589
  • 13
  • 17
  • 23
  • have you loaded these drivers in your php.ini? extension=php_pdo_sqlsrv_54_ts.dll extension=php_sqlsrv_54_ts.dll – Ed Bangga Sep 10 '19 at 06:29
  • https://stackoverflow.com/questions/24776078/, https://stackoverflow.com/questions/22015179/, https://www.php.net/manual/en/sqlsrv.installation.php – misorude Sep 10 '19 at 06:29
  • download your drivers in here https://learn.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server?view=sql-server-2017 – Ed Bangga Sep 10 '19 at 06:30
  • https://stackoverflow.com/questions/30736601/fatal-error-call-to-undefined-function-sqlsrv-connect-in-c-xampp-htdocs – Stanley Fernandes Sep 10 '19 at 06:32

0 Answers0