How to connect to MSSQL DB with wamp64










2















I'm using wamp64 as localhost for programming my php code.

But now I got asked to connect to a MSSQL DB.

I searched for answers on how to do it and found sqlsrv_connect() function.

When I call this function I get this error:




Uncaught Error: Call to undefined function sqlsrv_connect() in C:wamp64




I'm not familiar with this, so could someone help me with instructions on how to fix this?

I also read that I need to install!? (I don't understand how to do this)



My PHP version is 7.2.4



This is my code:



$serverName = "server, 1433"; //serverNameinstanceName, portNumber
$connectionInfo = array( "Database"=>"DB", "UID"=>"USERNAME", "PWD"=>"PASSWORD");
$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 also downloaded some EXE files:




SQLSRV30.EXE, SQLSRV31.EXE, SQLSRV32.EXE, SQLSRV40.EXE




What do they mean? Which one should I have?

Please someone help me with this.



Edit: After trying the answer, I got this error:




PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'











share|improve this question




























    2















    I'm using wamp64 as localhost for programming my php code.

    But now I got asked to connect to a MSSQL DB.

    I searched for answers on how to do it and found sqlsrv_connect() function.

    When I call this function I get this error:




    Uncaught Error: Call to undefined function sqlsrv_connect() in C:wamp64




    I'm not familiar with this, so could someone help me with instructions on how to fix this?

    I also read that I need to install!? (I don't understand how to do this)



    My PHP version is 7.2.4



    This is my code:



    $serverName = "server, 1433"; //serverNameinstanceName, portNumber
    $connectionInfo = array( "Database"=>"DB", "UID"=>"USERNAME", "PWD"=>"PASSWORD");
    $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 also downloaded some EXE files:




    SQLSRV30.EXE, SQLSRV31.EXE, SQLSRV32.EXE, SQLSRV40.EXE




    What do they mean? Which one should I have?

    Please someone help me with this.



    Edit: After trying the answer, I got this error:




    PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'











    share|improve this question


























      2












      2








      2








      I'm using wamp64 as localhost for programming my php code.

      But now I got asked to connect to a MSSQL DB.

      I searched for answers on how to do it and found sqlsrv_connect() function.

      When I call this function I get this error:




      Uncaught Error: Call to undefined function sqlsrv_connect() in C:wamp64




      I'm not familiar with this, so could someone help me with instructions on how to fix this?

      I also read that I need to install!? (I don't understand how to do this)



      My PHP version is 7.2.4



      This is my code:



      $serverName = "server, 1433"; //serverNameinstanceName, portNumber
      $connectionInfo = array( "Database"=>"DB", "UID"=>"USERNAME", "PWD"=>"PASSWORD");
      $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 also downloaded some EXE files:




      SQLSRV30.EXE, SQLSRV31.EXE, SQLSRV32.EXE, SQLSRV40.EXE




      What do they mean? Which one should I have?

      Please someone help me with this.



      Edit: After trying the answer, I got this error:




      PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'











      share|improve this question
















      I'm using wamp64 as localhost for programming my php code.

      But now I got asked to connect to a MSSQL DB.

      I searched for answers on how to do it and found sqlsrv_connect() function.

      When I call this function I get this error:




      Uncaught Error: Call to undefined function sqlsrv_connect() in C:wamp64




      I'm not familiar with this, so could someone help me with instructions on how to fix this?

      I also read that I need to install!? (I don't understand how to do this)



      My PHP version is 7.2.4



      This is my code:



      $serverName = "server, 1433"; //serverNameinstanceName, portNumber
      $connectionInfo = array( "Database"=>"DB", "UID"=>"USERNAME", "PWD"=>"PASSWORD");
      $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 also downloaded some EXE files:




      SQLSRV30.EXE, SQLSRV31.EXE, SQLSRV32.EXE, SQLSRV40.EXE




      What do they mean? Which one should I have?

      Please someone help me with this.



      Edit: After trying the answer, I got this error:




      PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'








      php sql-server database-connection sqlsrv






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 11:02







      Jelle Botman

















      asked Nov 12 '18 at 9:11









      Jelle BotmanJelle Botman

      6331928




      6331928






















          2 Answers
          2






          active

          oldest

          votes


















          1














          I solved it ~ PHP Version 7.2.4



          pdo_sqlsrv : 5.3.0+11108



          1.download the proper version sqlsrv and sqlsrv pdo



          2.put it into XAMPPPHPext folder



          3.after that write the line into php.ini > module setting



          extension=php_pdo_sqlsrv_72_ts.dll



          extension=php_sqlsrv_72_ts.dll



          4.let's make a test for MSSQL still there is an error msg for recommending you to download ODBC Driver for SQL



          1. Go to https://docs.microsoft.com/zh-tw/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017 then download the proper file

          (mine is Command Line Utilities 11 for SQL Server® X86)



          6.fire the test.php again everything works!






          share|improve this answer

























          • In what folder do I need to put those files?

            – Jelle Botman
            Nov 12 '18 at 9:36











          • I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

            – Jelle Botman
            Nov 12 '18 at 9:42











          • @JelleBotman updated my answer, try this solution

            – Sayed Mohd Ali
            Nov 12 '18 at 10:00











          • Still not working, did everything u said but from step 5 I don't understand anymore

            – Jelle Botman
            Nov 12 '18 at 10:11











          • It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

            – Jelle Botman
            Nov 12 '18 at 11:01


















          0














          I followed @SayedMohdAli's steps and Got this error:




          PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'




          I changed the name from 'sqlsrv_72_nts' to 'sqlsrv_72_ts' and It worked.



          @SayedMohdAli thanks for helping me with this getting started. Solved it with your help.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258948%2fhow-to-connect-to-mssql-db-with-wamp64%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I solved it ~ PHP Version 7.2.4



            pdo_sqlsrv : 5.3.0+11108



            1.download the proper version sqlsrv and sqlsrv pdo



            2.put it into XAMPPPHPext folder



            3.after that write the line into php.ini > module setting



            extension=php_pdo_sqlsrv_72_ts.dll



            extension=php_sqlsrv_72_ts.dll



            4.let's make a test for MSSQL still there is an error msg for recommending you to download ODBC Driver for SQL



            1. Go to https://docs.microsoft.com/zh-tw/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017 then download the proper file

            (mine is Command Line Utilities 11 for SQL Server® X86)



            6.fire the test.php again everything works!






            share|improve this answer

























            • In what folder do I need to put those files?

              – Jelle Botman
              Nov 12 '18 at 9:36











            • I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

              – Jelle Botman
              Nov 12 '18 at 9:42











            • @JelleBotman updated my answer, try this solution

              – Sayed Mohd Ali
              Nov 12 '18 at 10:00











            • Still not working, did everything u said but from step 5 I don't understand anymore

              – Jelle Botman
              Nov 12 '18 at 10:11











            • It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

              – Jelle Botman
              Nov 12 '18 at 11:01















            1














            I solved it ~ PHP Version 7.2.4



            pdo_sqlsrv : 5.3.0+11108



            1.download the proper version sqlsrv and sqlsrv pdo



            2.put it into XAMPPPHPext folder



            3.after that write the line into php.ini > module setting



            extension=php_pdo_sqlsrv_72_ts.dll



            extension=php_sqlsrv_72_ts.dll



            4.let's make a test for MSSQL still there is an error msg for recommending you to download ODBC Driver for SQL



            1. Go to https://docs.microsoft.com/zh-tw/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017 then download the proper file

            (mine is Command Line Utilities 11 for SQL Server® X86)



            6.fire the test.php again everything works!






            share|improve this answer

























            • In what folder do I need to put those files?

              – Jelle Botman
              Nov 12 '18 at 9:36











            • I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

              – Jelle Botman
              Nov 12 '18 at 9:42











            • @JelleBotman updated my answer, try this solution

              – Sayed Mohd Ali
              Nov 12 '18 at 10:00











            • Still not working, did everything u said but from step 5 I don't understand anymore

              – Jelle Botman
              Nov 12 '18 at 10:11











            • It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

              – Jelle Botman
              Nov 12 '18 at 11:01













            1












            1








            1







            I solved it ~ PHP Version 7.2.4



            pdo_sqlsrv : 5.3.0+11108



            1.download the proper version sqlsrv and sqlsrv pdo



            2.put it into XAMPPPHPext folder



            3.after that write the line into php.ini > module setting



            extension=php_pdo_sqlsrv_72_ts.dll



            extension=php_sqlsrv_72_ts.dll



            4.let's make a test for MSSQL still there is an error msg for recommending you to download ODBC Driver for SQL



            1. Go to https://docs.microsoft.com/zh-tw/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017 then download the proper file

            (mine is Command Line Utilities 11 for SQL Server® X86)



            6.fire the test.php again everything works!






            share|improve this answer















            I solved it ~ PHP Version 7.2.4



            pdo_sqlsrv : 5.3.0+11108



            1.download the proper version sqlsrv and sqlsrv pdo



            2.put it into XAMPPPHPext folder



            3.after that write the line into php.ini > module setting



            extension=php_pdo_sqlsrv_72_ts.dll



            extension=php_sqlsrv_72_ts.dll



            4.let's make a test for MSSQL still there is an error msg for recommending you to download ODBC Driver for SQL



            1. Go to https://docs.microsoft.com/zh-tw/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-2017 then download the proper file

            (mine is Command Line Utilities 11 for SQL Server® X86)



            6.fire the test.php again everything works!







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 12 '18 at 9:59

























            answered Nov 12 '18 at 9:32









            Sayed Mohd AliSayed Mohd Ali

            1,4472519




            1,4472519












            • In what folder do I need to put those files?

              – Jelle Botman
              Nov 12 '18 at 9:36











            • I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

              – Jelle Botman
              Nov 12 '18 at 9:42











            • @JelleBotman updated my answer, try this solution

              – Sayed Mohd Ali
              Nov 12 '18 at 10:00











            • Still not working, did everything u said but from step 5 I don't understand anymore

              – Jelle Botman
              Nov 12 '18 at 10:11











            • It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

              – Jelle Botman
              Nov 12 '18 at 11:01

















            • In what folder do I need to put those files?

              – Jelle Botman
              Nov 12 '18 at 9:36











            • I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

              – Jelle Botman
              Nov 12 '18 at 9:42











            • @JelleBotman updated my answer, try this solution

              – Sayed Mohd Ali
              Nov 12 '18 at 10:00











            • Still not working, did everything u said but from step 5 I don't understand anymore

              – Jelle Botman
              Nov 12 '18 at 10:11











            • It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

              – Jelle Botman
              Nov 12 '18 at 11:01
















            In what folder do I need to put those files?

            – Jelle Botman
            Nov 12 '18 at 9:36





            In what folder do I need to put those files?

            – Jelle Botman
            Nov 12 '18 at 9:36













            I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

            – Jelle Botman
            Nov 12 '18 at 9:42





            I got those files, added them to C:/wamp64/bin/php/php7.2.4/ext, added those lines to php.ini but I see no change

            – Jelle Botman
            Nov 12 '18 at 9:42













            @JelleBotman updated my answer, try this solution

            – Sayed Mohd Ali
            Nov 12 '18 at 10:00





            @JelleBotman updated my answer, try this solution

            – Sayed Mohd Ali
            Nov 12 '18 at 10:00













            Still not working, did everything u said but from step 5 I don't understand anymore

            – Jelle Botman
            Nov 12 '18 at 10:11





            Still not working, did everything u said but from step 5 I don't understand anymore

            – Jelle Botman
            Nov 12 '18 at 10:11













            It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

            – Jelle Botman
            Nov 12 '18 at 11:01





            It says Unable to load dynamic library 'pdo_sqlsrv_72_nts' c:/wamp64/bin/php/php7.2.4/ext/php_sqlsrv_72_nts.dll

            – Jelle Botman
            Nov 12 '18 at 11:01













            0














            I followed @SayedMohdAli's steps and Got this error:




            PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'




            I changed the name from 'sqlsrv_72_nts' to 'sqlsrv_72_ts' and It worked.



            @SayedMohdAli thanks for helping me with this getting started. Solved it with your help.






            share|improve this answer



























              0














              I followed @SayedMohdAli's steps and Got this error:




              PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'




              I changed the name from 'sqlsrv_72_nts' to 'sqlsrv_72_ts' and It worked.



              @SayedMohdAli thanks for helping me with this getting started. Solved it with your help.






              share|improve this answer

























                0












                0








                0







                I followed @SayedMohdAli's steps and Got this error:




                PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'




                I changed the name from 'sqlsrv_72_nts' to 'sqlsrv_72_ts' and It worked.



                @SayedMohdAli thanks for helping me with this getting started. Solved it with your help.






                share|improve this answer













                I followed @SayedMohdAli's steps and Got this error:




                PHP Startup: Unable to load dynamic library 'sqlsrv_72_nts'




                I changed the name from 'sqlsrv_72_nts' to 'sqlsrv_72_ts' and It worked.



                @SayedMohdAli thanks for helping me with this getting started. Solved it with your help.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 12 '18 at 12:32









                Jelle BotmanJelle Botman

                6331928




                6331928



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258948%2fhow-to-connect-to-mssql-db-with-wamp64%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

                    Edmonton

                    Crossroads (UK TV series)