I am trying to add the PDO drivers so I can work with MSSQL
I get error 'could not find driver'. In my php.ini I have tried adding
extension=php_pdo_sqlsrv_53_ts.dll
extension=php_pdo_sqlsrv_53_ts_vc9.dll
extension=php_pdo_sqlsrv_53_ts_vc6.dll
But my phpinfo() shows no sqlsrv in PDO, only mysql and sqlite
My PHP Version : 5.3.9
Compiler : MSVC9 (Visual C++ 2008)
I finally found my own answer...
My php.ini file that was loaded was not from
wamp\bin\php\php5.3.9\php.ini
but from
wamp\bin\apache\apache2.2.21\php.ini
Related
Getting the following error when testing an upgrade to PHP7 x64:
odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I've installed the following:
PHP 7.0.0 x64
Microsoft ODBC Driver 11 for SQL Server x64
Microsoft Visual C++ 2015 Redistributable x64
Microsoft Visual C++ 2015 Redistributable x86
The (thread-safe) preview of the PHP 7 MSSQL drivers: https://github.com/Azure/msphpsql
I have uncommented/added the following lines of my phpini:
extension=php_pdo_mysql.dll (uncommented)
extension=php_odbc.dll (added)
extension=php_sqlsrv_7_ts.dll (added)
extension=php_pdo_sqlsrv_7_ts.dll (added)
Things to consider:
I can see that the modules are indeed loaded in phpinfo.
I've added the ODBC connection and can see it in System DSN.
I am successfully able to connect via sqlsrv_connect() but not odbc_connect(), which is what all our previous PHP 5.6 scripts are using.
Can't seem to find the answer anywhere else. Any help would be appreciated. Thanks.
I seem to have solved my own issue.
Turns out, the ODBC_CONNECT string uses an explicit DSN name and not a database, apparently...
Previously my ODBC Connect string was $conn = odbc_connect('DB',$DBUSER, $DBPASS)
and my ODBC Data Source was "SERVERNAME"
Once I changed the ODBC Data Source name to match the DB name, it worked.
I have installed the mongo db server and i have run the server from the command prompt administrator up to installing the mongo db server and running the mongo db server was fine.
when i have to install the mongo db php driver
the specifications mentioned by the php mongo db server i have done...here i am placing my details what needs
PHP Version 5.6.12
Compiler MSVC11 (Visual C++ 2012)
Zend Extension Build API220131226,TS,VC11
PHP Extension Build API20131226,TS,VC11
i have choosen the php_mongo-1.6.8-5.6-vc11-nts and renamed it as php_mongo and placed in php extension folder
and in php.ini file written extension=php_mongo.dll after that i have restarted my xampp server
even though it is giving the following error
Fatal error: Class 'Mongo' not found in C:\xampp\htdocs\test\test.php on line 3
please suggest anyone
thanks in advance
I wanted to setup a database connection from PHP to SQL server 2012.I have a wamp server(64 bit) set up on a windows machine(64 bit) with PHP 5.5.12 and on the same machine I have SQL server 2012 installed.
Extracted sqlsrv drivers from official_link
Copied the extracted drivers php_sqlsrv_55_ts.dll, extension = php_pdo_sqlsrv_55_ts.dll to php\ext folder, and then changed the php.ini file to include the extensions
extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
Now I tried
<?php
phpinfo();
?>
I see the following information without any SQL server information in it.
Don't seem to have configured SQL server connection successfully. Could some one please guide me on what I am missing here.
64 bit WAMP server was not able to connect using the drivers extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
So, I installed a 32 bit version of the WAMP server and it works fine now.
Check the php error log (c:\wamp\logs\php_error.log).
I had the same setup (64bit WAMP/PHP 5.5.12) and same missing sqlsrv reference in phpinfo and I got this error in my log:
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' - %1 is not a
valid Win32 application. in Unknown on line 0
The solution was to install the 64bit version of the sqlsrv drivers. I found the unofficial 64bit drivers through http://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html
Warning: In my testing I found these 64bit PHP_PDO_SQLSRV extension 10 times slower than when using PHP_PDO_ODBC.
I am visiting this thread and i think this might help full for you and other with the same issue:
How can I install pdo_sqlsrv on my windows 2008 Server 2008 R2?
The PDO Extension is not the same as the native driver Microsoft is offering. For PDO you must enable
extension=php_pdo_mssql.dll
in your php.ini.
{Normally this file (php_pdo_mssql.dll) should be in your PHP extension-directory (C:...\php\ext). If it's not there you can download PHP from http://windows.php.net/download/ and just take the extension from a package there (take one that correspond with your PHP version of course)}.
Above is taken from PDO MSSQL Server - Driver not found
read for more details. i have the same issue foe linux and i have saved all the pages thats why i am quoting for you help.
if all above didn't work for you then:
On the php.net it is listed that
On Windows, PDO_ODBC is built into the PHP core by default. It is linked against the Windows ODBC Driver Manager so that PHP can connect to any database cataloged as a System DSN, and is the recommended driver for connecting to Microsoft SQL Server databases.
http://php.net/manual/en/ref.pdo-odbc.php
You can connect to mssql server using odbc drivers as i have never connect by my self from windows i use to do it through linux using freeTds, following pages might help you
http://craigballinger.com/blog/2011/08/usin-php-5-3-with-mssql-pdo-on-windows/
Connect PHP to MSSQL via PDO ODBC
PHP to SQL Server without ODBC or MSSQL support
I am gettin following error when I connect to mssql
Uncaught exception 'PDOException' with message 'SQLSTATE[IMSSP]: This extension requires the Microsoft SQL Server 2012 Native Client ODBC Driver to communicate with SQL Server
And I am using
$db = new PDO("sqlsrv:server=127.0.0.1;database=test;", "sa", "mypassword");
I have also added driver in C:\xampp\php\ext and set that extension in php.ini file
[PHP_PDO_MSSQL]
extension=php_pdo_sqlsrv_54_ts.dll
I have tried several tutorials, what exactly I am doing, Please tell what I am doing wrong?
what version of the php pdo sqlsrv are you using?
Try updating it to v3.1
http://www.microsoft.com/en-us/download/details.aspx?id=20098
You might neet the ODBC driver as well:
http://www.microsoft.com/en-us/download/details.aspx?id=36434
Am using windows 8 pro, Wamp server (php V5.3.5, apache V2.2.17), Sql server 2005 express editon. I have downloaded the sqlsrv drivers and extracted them into the php extention folder (C:\wamp\bin\php\php5.3.5\ext), have also update the php.ini file by adding the extentions
extension=php_sqlsrv_53_ts_vc6.dll
extension=php_pdo_sqlsrv_53_ts_vc6.dll
I used this two after series of try and error on all the dll file, it was this two that come up with no error, when restarting the wamp server
This is the connection line of code;
$con = sqlsrv_connect('TAQUATECH\SQLEXPRESS') or die("cannot connect");
It came up with the following error;
Fatal error: Call to undefined function sqlsrv_connect() in
C:\wamp\www\Webs\client.php on line 7
pls, i need somebody to help me on this, i will really appreciate
Sorry if too late to answer, but I had the same error, and I found out that Wamp Server 64bit does not support SQL Server Connection, you must install a 32bit version of wamp server.
For those using 64-bit systems (OS, WAMP, MSSQL), these 64-bit drivers can serve them and fix the error:
Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www...
Drivers SQLSRV x64:
http://robsphp.blogspot.in/2012/06/unofficial-microsoft-sql-server-driver.html
You'll need to install and enable sqlsrv on your web server. Have a look at the installation page on the official PHP website.
Installation of Microsoft Drivers 3.0 for PHP for SQL Server will fix this issue. Also try this PHP Manual.
EDIT :
The most recent version of the driver is available for download here:
» SQLSRV 3.0 download. If you need support for PHP 5.2 and/or PHP
compiled with VC6, use the 2.0 release of the driver: » SQLSRV 2.0
download.
Source
Yap, I have gotten a work-around;
The problem was, running the php script using apache server on my system, I stoped the wamp server and configure fastCGI for PHP using IIS 7, You can get a video tutorial Here
http://www.iis.net/learn/application-frameworks/running-php-applications-on-iis/set-up-fastcgi-for-php.
It simple and nice, now i can connect to both sql server 2005 and 2008
My PHP Details
Version => 5.3.5
Compiler => MSVC6 (Visual C++ 6.0)
SqlSrv Driver => php_sqlsrv_53_ts_vc6.dll
use 32 bit PHP Version.
enable below one of them in php.ini
[PHP_PDO_SQLSRV_53_NTS]
extension=php_pdo_sqlsrv_53_nts.dll
[PHP_SQLSRV_54_NTS]
extension=php_sqlsrv_54_nts.dll
[PHP_SQLSRV_53_NTS]
extension=php_sqlsrv_53_nts.dll
[PHP_PDO_SQLSRV_54_NTS]
extension=php_pdo_sqlsrv_54_nts.dll
thease dll version you can downlowd online