PHP 7 SQLSRV driver doesn't load - php

I been trying to connect to my local MSSQL database using php.
Right now I am stuck at installing the correct drivers for php to work with MSSQL.
SO far I have:
1.Downloaded and setup Xampp
2.Downloaded the the SQLSRV driver at:https://github.com/Microsoft/msphpsql/releases/tag/v4.3.0
3.Placed the files within my extension_dir and double checked php.ini varible to point to the correct folder.
4. Manually added
extension=php_pdo_sqlsrv_71_ts.dll
extension=php_sqlsrv_71_ts.dll
to the list of extension within php.ini.
Yet I am still seeing the same Fatal error and a boolean checking if the driver has been loaded returns false:
bool(false)
Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() in
C:\xampp\htdocs\firsttest\api.php:9 Stack trace: #0 {main} thrown in
C:\xampp\htdocs\firsttest\api.php on line 9
Did I miss a step? I have been following different guidelines and some of them seemed outdated. I tried installing ODBC driver and the installer said that I had a higher version. Therefore I expect that shouldn't cause any problems.

By double checking everything I realize that Xampp always install as a 32-bit application. Therefore i should've taken the 86-bit version of the .dll files instead of the 64-bit.
Atleast this solved the problem for me.

Related

I am getting sql server connection error with xampp

Actually, I followed all the paths in the document, but I still get an undefined sql error while connecting.
I followed these paths respectively.
1-Microsoft® ODBC Driver 11 for SQL Server® install
2-Microsoft Drivers for PHP for SQL Server this version: 7.3
dll files in the corresponding folder
php / ext
php_pdo_sqlsrv_73_nts_x64.dll
php_pdo_sqlsrv_73_ts_x64.dll
then I restarted xampp, i viewed phpinfo
But when I run my file the error I get is:
Fatal error: Uncaught Error: Call to undefined function
sqlsrv_connect() in
what could be missing?
You need to enable PHP Driver for SQL Server, but not PDO version. Function sqlsrv_connect() and all sqlsrv_ functions are part of the SQLSRV driver.
To enable the SQLSRV driver, you need to modify the php.ini by adding the appropriate line to the extension section - php_sqlsrv_73_nts_x64.dll or php_sqlsrv_73_ts_x64.dll depending on the PHP version.
Of course, as an option, you may try to rewrite your code using PDO (PHP Data Objects). The PDPO_SQLSRV part of the driver is installed on your WEB server.

Installing PDO driver for MySQL on windows

I am using quickphp to process my php file with was previously processed using wamp server. I also installed mysql for the database. I am using pdo with was working fine on wamp but i get this error while trying to access the site now.
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Users***\Documents***\includes\database.php:3 Stack trace: #0 C:\Users***\Documents***\includes\database.php(3): PDO->__construct('mysql:host=loca...', 'root', 'root') #1 C:\Users***\Documents***\menu.php(7): require('C:\Users\selfse...') #2 {main} thrown in C:\Users***\Documents***\includes\database.php on line 3
How can i install pdo driver for mysql. I have searched the net but still clueless.
It's a common problem, and one I've solved for a few people recently. Make sure you check the following list to ensure you have put them in place:
Ensure both php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll are in
your /ext directory. Ensure the following lines are present in your
php.ini file: extension=php_pdo_sqlsrv_54_ts.
dll & extension=php_sqlsrv_54_ts.dll.
Ensure you have installed VC++ redist located here. Make sure you download and install the x86
version regardless of the architecture of your OS otherwise this
will not work.
Check these things and come back to me with an answer.

Cant load MongoDb driver in php.ini using Apache in Xampp

I am trying to learn PHP with mongodb backend, but I could not connect PHP to mongo because of the following error:
fatal error Mongo class undefined
I am using Xampp and netbeans as IDE. I looked it up and got that the drivers are to be installed.
So I downloaded the drivers which is php_mongo-1.4.x-5.5-vc11.dll. I put it in the .../php/ext/folder and edit php.ini placing extention = php_mongo.....dll.
But still when I start my apache it says php_mongo...dll not found althought it is placed correctly. Also it says libsasl.dll not found, which when I looked up, it was in place.
I have mongodb installed and I have correct driver version, so why does it happen?

php sqlsrv driver is not being recognized

my PHP Version is 5.6 and I ve already downloaded the driver for the sqlsrv extension and placed it in the ext/ directory, as well as modified the php.ini with the new extensions.
I still get the following error when trying to connect to my database
Fatal error: Call to undefined function sqlsrv_connect() in C:\inetpub\wwwroot\db.php on line 12
Is there anything that i've missed?
Did you change Edit System Variable and Windows extensions ?
You can find here : http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php
Good luck..

sqlsrv_connect() not found

I'm working on a project that uses the SQL Server Driver for PHP, and want to upgrade the driver to the new version (2.0), because I need some of the functions that have been implemented there.
I replaced the old .dll in the php/ext directory and restarted the web server. But now I receive the following error:
Fatal error: Call to undefined function sqlsrv_connect() in E:\ProjekteExtern\hades\_apl\classes\sql\sqlsrv.class.php on line 34
The phpinfo() output shows sqlsrv, just like with the previous version.
Does anybody know why I'm getting this error or have any ideas to solve this problem?
For those still having errors with PHP and Microsoft SQL Server using PHP SQL, check the web server's log (Apache, IIS, etc). I have just found out that WampServer x64 is not compatible with PHP SQL Server Driver, so I'm installing the 32-bit version back again.
UPDATE:
for WampServer 2.2, PHP is compiled thread-safe and with VC++ 9.0, so it works using either
php_pdo_sqlsrv_53_ts_vc9.dll
or
php_sqlsrv_53_ts_vc9.dll

Categories