Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

SQLSRV in WAMP64 3.1.0 For CLI (5 replies)

$
0
0
Hi. On a 64 bit WIndows Server 2012 R2 machine I am using:

- WAMP 3.1.0 (64 bit)
- PHP 7.1.9
- Apache 2.4.27

I have installed sqlsrv because I need to access a MS SQL db from PHP via PDO.
I have thus added the following files to the C:\wamp64\bin\php\php7.1.9\ext directory:

- php_pdo_sqlsrv_71_ts.dll
- php_sqlsrv_71_ts.dll

I have also added the following entries to php.ini:

- extension=php_pdo_sqlsrv_71_ts.dll
- extension=php_sqlsrv_71_ts.dll

Everything works fine from the web browser: phpinfo() displays the sqlsrv drivers and I can establish connections to the DB.

When I run the same scripts via CLI, however, I get an "Uncaught PDOException: could not find driver" error.

I've read that I need to update the php.ini file that is used by CLI, but whereas I'm used to seeing two different php.ini files in older versions of WAMP, there only seems to be one here (while the other is a symbolic link to the one). I'm pulling my hair out trying to figure out what is going on.

When I run php -i from the command line I can see that the sqlsrv driver is indeed not there.

I have noticed that the About section of WAMPSERVER is showing me that whereas Apache is running PHP 7.1.9, it says that PHP 5.6.31 for CLI is being used, which may very well be my problem. But if my batch script explicitly says to use version 7.1.9 (and the -v option response shows me that it is) I don't really know what is going on.

Any help would be very much appreciated.

Thanks

Viewing all articles
Browse latest Browse all 3177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>