Not getting connected to Sql Server 2012 - php

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.

Related

cannot connect ms sql to php7 on windows 10

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

PHP 7 on IIS: Call_user_function could not be located

I am trying to use the Microsoft SQL Server drivers with PHP 7.1 Not Thread Safe x64 on Windows 2012 R2 64-bit server.
No matter what I do I am getting an error when I run php from a admin command prompt
Warning: PHP Startup: Unable to load dynamic library
'ext\php_pdo_sqlsrv_7_nts.dll' - The specified procedure could not be
found.
Additionally it display a windows pop up that states
The procedure entry point call_user_function could not be located in
the dynamic link library C:\PHP7\ext\php_pdo_dqlsrv7_nts_x64.dll
I have verified that the php.ini is pointing to a file that exists, because if I rename the .dll file, the error messages changes to "specified module could not be found", instead of specified procedure.
I have installed Microsoft Visual C++ runtime 15 x64 as required by PHP 7.
I have installed Microsoft ODBC driver 13 as required by the Microsoft SQL Server driver.
I have rebooted the server twice.
There is nothing else I can think to even try. The Microsoft WinCache.dll is loading and working fine in PHP, as verified by phpinfo.
Confirmed what #MEmerson said above. You need to downgrade PHP to 7.0.X(?) - I used 7.0.12.
Complete Setup:
Windows 10 Pro
PHP X64 7.0.12 TS (Bitnami WAMP Stack)
Microsoft ODBC Driver 13.1 for SQL Server (https://msdn.microsoft.com/en-us/library/mt703139(v=sql.1).aspx)
Microsoft Drivers for PHP for SQL Server 4.0 (https://www.microsoft.com/en-ca/download/details.aspx?id=20098)
Same drivers with PHP X64 7.1.0 produced the error you are getting.
Microsoft Drivers 4.3 for PHP for SQL Server are now available.
These drivers contains files for PHP 7.1 - php_pdo_sqlsrv_71_nts_x64.dll etc.
I've successfully managed to connect to SQL server.
Had similar error when tried to use httpd (Apache), PHP 7.2.2, Microsoft ODBC driver 11 on MS Windows Server 2012. The text of error was:
The procedure entry point call_user_function could not be located in the dynamic link library php_pdo_sqlsrv_7_ts_x64.dll.
when I called php -m to check modules.
So I have downloaded Windows-7.2.zip from https://github.com/Microsoft/msphpsql/releases and used thread-safe dlls from it.
php -m works now as it should without giving error.
Same as NoCopy
Windows Server 2012
php-7.0.15-Win32-VC14-x64.zip from (http://windows.php.net/download)
Visual C++ Redistributable for Visual Studio 2015 (https://www.microsoft.com/en-us/download/details.aspx?id=48145)
Microsoft ODBC Driver 13.1 for SQL Server
Microsoft Drivers for PHP for SQL Server 4.0
7.1.x still a No,NO from Microsoft
It happened to me today while enabling the extensions in the IIS, where I by mistake enabled different versions for pdo & driver extensions (E.g. php_sqlsrv_7_nts_x86.dll for PHP 7.0 & php_pdo_sqlsrv_72_nts_x86.dll for PHP 7.2).
Usually the package that you download from Microsoft that contains Microsoft Drivers 5.3 for PHP for SQL Server has all the PHP extensions versions. https://www.microsoft.com/en-us/download/details.aspx?id=57163
Just make sure you enable both extensions for the same versions to avoid that error.

Configure Windows 10 WAMP PHP to connect to SQLServer 2008

I have been spending days on this project trying to connect to a database and have reached some what of a stand still. I'm hoping someone has some experience with this.
I have been given Remote Desktop credentials to a Windows Server(R) 2008 box. There is a database running on that machine, and the client would like to pull data out of it from another domain - it is running SQLServer 2008.
As a test I am trying to connect to it via a local WAMP install. I was able to get the following .dll's running in my local PHP after downgrading it to its 32 bit version:
- php_pdo_sqlsrv_55_ts.dll
- php_sqlsrv_55_ts.dll
However, when I try to use PDO or the sqlsrv_connect function to connect, I receive the error message:
SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712
When I try to download and install the Microsoft ODBC Driver 11 (https://www.microsoft.com/en-us/download/details.aspx?id=36434) - I receive the following error message:
Installation of this product failed because it is not supported on this operating system. For information on supported configurations, see the product documentation.
My question is, is there a way to connect to a SQLServer 2008 database from a WAMP install on a Windows 10 machine? - as far as I can tell it is not supported on Windows 10.
Thank you for your time.
I'm on Windows 10. I have the 64bit wamp server installed running php 7.0.10.
I was able to connect to a Microsoft Azure database.
I had to install The
Microsoft® ODBC Driver 11 for SQL Server® - Windows
this version of it
ENU\x64\msodbcsql.msi
This is the url:
https://www.microsoft.com/en-us/download/details.aspx?id=36434
I also had to load "php_pdo_sqlsrv_7_ts_x64.dll" file to the folder
C:/wamp64/bin/php/php7.0.10/ext
and add the
extension=php_pdo_odbc.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll
to the php.ini file
this was for a Cakephp 3.55 project

php access mssql 2005 database, sqlsrv drivers

I am attempting to access a mssql 2005 database using Microsoft's supplied sqlsrv drivers. I have tried every driver version from 3.1 to 2.0, installing a different version of XAMPP with different versions of PHP installed.
version 3.1 = php version 5.4.7
error:
This extension requires the Microsoft SQL Server 2012 Native Client.
Access the following URL to download the Microsoft SQL Server 2012
Native Client ODBC driver for x86
version 3.0 = php version 5.3.1 error:
This extension requires either the Microsoft SQL Server 2008 Native
Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native
Client ODBC Driver to communicate with SQL Server. Neither of those
ODBC Drivers are currently installed. Access the following URL to
download the Microsoft SQL Server 2008 R2 Native Client ODBC driver
for x86:
version 2.0 = php version 5.2.1 and 5.2.4
Php drivers are unrecognized and do not appear in phpinfo().
I am under the impression the extension should support ALL EDITIONS of SQL Server 2005 and greater...
I installed both the SQL Server 2012 Native Client and the SQL Server 2008 Native Client (SP3).
According to this article I can test the ODBC connectivity to a SQL Server.
Entering odbcping at a command prompt returns:
'odbcping' is not recognized as an internal or external command....
I checked the ODBC Data Source Administrator and found the ODBC Driver 11 for SQL Server is listed in the drivers tab.
Any assistance as to what I may be missing?
You are mixing up two things: ODBC and PHP drivers for MS SQL Server 2005.
If you install SQLDRV 3.X, you dont use ODBC.
If you use ODBC, then you may need different PHP driver than SQLDRV.
I also struggled few hours with setting up PHP connection to MS SQL Server 2003, 2005, 2008 with Studio Express. I used pdo_sqldrv driver installed via SQLDRV drivers provided by Microsoft. Installing PHP drivers was easy part. Once you see pdo_sqldrv in phpinfo(), you are done with PHP driver. Difficult is second part - setting up properly MSSQL environment to allow PHP for connection. I did following steps:
downloaded & installed free MSSQL Studio Express 2005 (or 2008, both work fine)
installed or upgraded to dotNetFx40Setup.exe
installed msxml6.msi (I think this was only needed for version 2005)
installed MSSQL Native Client
logged into studio and created new user for PHP only with read/write permissions
enabled pipe and other connection resources
figured out correct connection string "sqlsrv:server=PCHOME\\SQLEXPRESS;database=eshop"
Then it worked, but definitely it was not easy setup. G'd luck.

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

Categories