cannot connect ms sql to php7 on windows 10 - php

i have windows 10 64 bit and i installed php7 and apache 2.4 but i cannot connect to ms sql 2008 R2 i downloaded the drivers and moved them to the ext folder of the php and modify the php.ini but cannot see them in the phpinfo() page
php/ext
php.ini
the first image see the two files i downloaded
the second image show i edited the php.ini
but i still cannot connect
phpinfo
the third one show that no pdo drivers and no
sqlsrv
any solution guys ???

Ignore this, I overlooked that you did have the drivers in your op
You need to install the Microsoft SQL server drivers. Your op didn't mention that these were installed.
https://www.microsoft.com/en-us/download/details.aspx?id=20098
Microsoft SQL server php drivers

Related

Sqlsrv dll does not properly load on IIS

I am using PHP 7.3 and trying to run sqlsrv but I cannot get my PHP environment to load sqlsrv. I look at the phpinfo and the extension does not show up. These are the steps I have taken.
Through the Web Platform Installer, I have installed PHP 7.3 for IIS, the SQL Server Driver, and the Windows Cache Extension.
I have put php_sqlsrv_73_nts_x64.dll in the extension directory.
I have verified my php.ini configurations.
Downloaded and installed the latest Microsoft ODBC driver.
Found the bug. Turns out I was had installed the SQL Server Driver for IIS when I really needed the SQL Server Driver for IIS Express.

sqlsrv drivers doesn't appear on a WAMP server phphinfo() after adding the extension entries in the php.ini file

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

Not getting connected to Sql Server 2012

I am getting following error while connecting to Sql Server 2012 in Laravel 4
PDOException SQLSTATE[IMSSP]: This extension requires the Microsoft
SQL Server 2012 Native Client ODBC Driver to communicate with SQL
Server. Access the following URL to download the Microsoft SQL Server
2012 Native Client ODBC driver for x86:
http://go.microsoft.com/fwlink/?LinkId=163712
As per this link
http://msdn.microsoft.com/en-us/library/cc296170.aspx
I downloaded and installed these two files in xampp/php/etc/ folder
php_sqlsrv_54_ts.dll
php_pdo_sqlsrv_54_ts.dll
And added these two in the php.ini file. But still I am seeing the same error.
I am using windows 7 and xampp. Please help.
I removed Xampp and installed Wamp (32 bit) server on my Windows 7, because after following almost every tutorial my xampp installation became unstable.
Following are the steps that resulted in successful connection to SQL SERVER 2012.
Download Microsoft SQL Driver for PHP
http://www.microsoft.com/en-in/download/details.aspx?id=20098
Click on the exe to extract it copy below two dlls
Add Extensions in the D:\wamp\bin\apache\Apache2.4.4\bin\php.ini
extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll
After that I downloaded and installed this Microsoft Sql Server 2012 SP1 Feature Pack
http://www.microsoft.com/en-in/download/details.aspx?id=35580
After this restart your computer.You should see these two blocks in your phpinof() output
thats it. Hope this will help someone.

install Microsoft Drivers for PHP for SQL Server on Windows 8

Does Windows 8 supports sql server driver for php.
I found that system Requirements for sql Driver does not contain Windows 8.
I installed and configured sql driver for php on wamp server, but sqlsrv doesn't show in phpinfo().
It's working fine for me on windows 8, if you don't activate the good extension in php.ini, by default (int XAMP) the slqsrv extension is selected extension=php_pdo_sqlsrv.dll, in my case, I am using PHP 5.4 and have configured the following extension:
extension=php_pdo_sqlsrv_54_ts.dll
See Readme file provided with the installation drivers to see which extension to activate in your case.
Restart the server and it's done.

'Error!: could not find driver' after installing php_[pdo_]mssql.dll on WampServer

Similar questions seem to be all over the internet, but so far nothing has helped.
I'm currently running WampServer with Apache 2.4.4 and PHP 5.4.12 on Windows Server 2008 R2. According to the PHP documentation the drivers necessary to connect to an MSSQL server ship with the distribution; they do not. Neither php_mssql.dll (which the documentation claims is no longer necessary for PHP5.4, but which is still referenced in php.ini. Who knows) nor php_pdo_mssql.dll are present in the distribution.
Several sources pointed to these drivers from Microsoft, however I had no success either renaming the respective drivers to php_mssql.dll/php_pdo_mssql.dll or keeping the names the same (php_sqlsrv_54_nts.dll, php_pdo_sqlsrv_54_ts.dll, etc.) and modifying php.ini to point to the proper driver. Though I didn't get an error upon starting apache as I do when the driver is simply missing, I received Error!: could not find driver when attempting to point to a test php page at localhost.
This article seemed the most promising, but unfortunately ntwdblib.dll is not included in the zip distributions of PHP, contrary to what the article claims. This seems like it should be a laughably simple problem: missing drivers, which are supposedly readily available. And yet here I am... What am I doing wrong?
In case anyone else ends up here while trying to solve this problem, here are the steps that have worked for me the two times I've done it. These steps worked both on Windows Server 2008 R2 and Windows 8.
For my purposes, I used the latest 32-bit (x86) version of WampServer (at the time of this writing, it was 2.4, and came with Apache 2.4.4 and PHP 5.4.16). The 32-bit version is necessary, as the drivers are 32-bit; the 64-bit version will not work.
Install Microsoft Visual C++ 2010 Redistributable Package x86
Install Microsoft SQL Server 2008 Native Client x86 (Click "Download" and select ENU\x86\sqlncli.msi. Once again, the 64-bit version will not work)
Install Microsoft ODBC Driver 11 x86 (Click "Download" and select 1033\x86\msodbcsql.msi)
Install Microsoft SQLSRV driver 3.0 in php/ext/ (For my installation, this was C:/wamp/bin/php/php5.4.16/ext/)
Edit Apache's php.ini to include the line extension=php_pdo_sqlsrv_54_ts.dll (for my installation, this was located in C:/wamp/bin/apache/Apache2.4.4/bin/)
You have to place the file in the directory for PHP/ext (bin/php/ext depending on your Wamp / Xampp installation). However, you also need the SQL server native client as per: http://msdn.microsoft.com/en-us/library/cc296170.aspx

Categories