How to connect to MSSQL DB with wamp64
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
add a comment |
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
add a comment |
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
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
php sql-server database-connection sqlsrv
edited Nov 12 '18 at 11:02
Jelle Botman
asked Nov 12 '18 at 9:11
Jelle BotmanJelle Botman
6331928
6331928
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
- 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!
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
|
show 1 more comment
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
- 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!
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
|
show 1 more comment
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
- 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!
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
|
show 1 more comment
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
- 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!
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
- 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!
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
|
show 1 more comment
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
|
show 1 more comment
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 12 '18 at 12:32
Jelle BotmanJelle Botman
6331928
6331928
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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