My question is based off of this post's answer from #Crontab. I downloaded SQLSRV40 from Microsoft website. When I try to install it is asking for
When I install, I have to enter a path to extract files and as it mentions in the website under installation instructions No.3 "When prompted, enter the path to the PHP extensions directory".
I have xampp and there is a php file directory. For my extracting path should I just give 'C:/xampp/php'?
I am a bit confused because, the under the comment section in the answer, #Crontab mentioned "My guess would be wherever you find all the other php_*.dll files". This means all the php_*.dll files should be under php folder right?
Also, say, if I extract them into that folder or different folder, when I added php_pdo_sqlsrv_7_nts_x64 into my php.ini folder and connected via apache I could not find my pdo_sqlsrv dll.
This is my first time installing SQL server drive. Any suggestion would be appreciated.
Seeming like main issue was sqlsrv drivers available for download on Microsoft sites currently only support PHP 7.0.+, i.e. not PHP 7.1 or 7.2.
The solution is to either download newer drivers (https://github.com/Microsoft/msphpsql/releases support for 7.2 but labeled as "technical preview") or to downgrade to PHP version 7.0.
Other common gotchas are:
Failing to download the additional required Microsoft ODBC drivers.
Confusion over x86 and x64 versions of drivers (also ts/nts "thread safe" and "non thread safe"). Will depend on your system/php install.
Also seeing that pecl offers the 'preview' versions of the drivers: https://pecl.php.net/package/pdo_sqlsrv/5.0.0/windows
There they also offer up this useful description:
The Microsoft Drivers for PHP for SQL Server are PHP extensions that allow for the reading and writing of SQL Server data from within PHP scripts. The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension implements PDO for accessing data in all editions of SQL Server 2008 R2 and later (including Azure SQL DB). These drivers rely on the Microsoft ODBC Driver for SQL Server to handle the low-level communication with SQL Server.
Related
According to the ADODB:
http://adodb.sourceforge.net/
documentation, it can be used for a number of databases on "Unix and Windows", so I'm assuming that includes OSX.
I've enabled PHP in my Apache installation, installed ADODB and modified include_path to include the ADODB directory, however I'm at a loss as to how to enable particular drivers. I have Firebird installed, so I'd prefer to connect to that, however I'm open to using some other database server.
I've managed to work it all out on a Windows install, however there seems to be scant information on how to do it on OSX.
I'm using xampp-win32-1.8.3-1-VC11-installer and i enabled php_mssql.dll extension in php.ini by remove ;
I copy php_mssql.dll to xampp\php\ext
and ntwdblib.dll to xampp\apache\bin
i got 2 files above in old of xampp version.
But when i start my apache in xampp then i get
How to fix that thanks
It announced from php website http://php.net/manual/en/intro.mssql.php
These functions allow you to access MS SQL Server database.
This extension is not available anymore on Windows with PHP 5.3 or later.
SQLSRV, an alternative extension for MS SQL connectivity is available from Microsoft: ยป http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx.
Since XAMPP 1.8.0 its used PHP 5.4.4 and php_mssql.dll extension is not available anymore on windows with PHP 5.3 or later.
So you can't use this library to your new XAMPP although you get it from your old XAMPP.
You must use alternative extension to connect to MS SQL Server database like SQLSRV.
See also ::
http://php.net/manual/en/intro.mssql.php
http://stackoverflow.com/questions/7402713/how-to-get-mssql-work-with-php-5-3
Your php version from XAMPP 1.8.3 is PHP 5.5.15, so you must use "php_sqlsrv_55_nts.dll" or "php_sqlsrv_55_ts.dll". Those files can be downloaded from http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=20098`.
Note :: see also the information on Details section to help you choose file that you must download
This link about documentation to code with sqlsrv library
http://php.net/manual/en/book.sqlsrv.php
Windows PHP extensions are neither forward nor backward compatible between second-level PHP versions. That means you cannot use a PHP 5.3 extension in PHP 5.4 and vice-versa.
As you're running XAMPP 1.8.3 and this is one of the first PHP bundles with the VC11-PHP5.5 builds you'll have to find a VC11-PHP5.5 compatible extension somewhere else.
I've just checked another WAMP bundle called EasyPHP, but they don't ship the MS SQL extension with their VC11-PHP5.5 bundle either.
I can't help with finding a compatible extension, though.
You could also build the extension yourself if that is an option for you.
I have mssql_* functions working on my Ubuntu installation and want to duplicate this on my windows 7 box. I have installed wamp on the win7 box, but I cannot get it to see the mssql_* functions. I have read many posts about nothing is working. I have the ext directory properly set. I have extension=php_mssql.dll do not see the mssql section in phpinfo, but I do see sqlsrv section. I would like my prod and test environment to match.
Thanks in advance for any assistance
Dean-O
I just checked my local wampserver 2.1 installation, and although there's an option to enable the php_mssql extension, it's missing from the extensions directory.
You can try the FreeTDS extension, which supposedly works fine under both *nix and Windows.
The Moodle wiki specifies that the Microsoft SQL Server driver has "known problems":
WARNING: This driver has known problems and is therefore not suitable
for any Moodle production servers.
and recommends the use of FreeTDS instead (by installing the php_dblib extension). Moodle is a known user of MSSQL, and a respected project, but they don't really specify what they mean by "known problems", so you can take this with a grain of salt...
http://docs.moodle.org/24/en/Installing_MSSQL_for_PHP
If FreeTDS doesn't work for you, you can try installing the official Microsoft drivers:
http://www.microsoft.com/en-us/download/details.aspx?id=20098
I have successfully configured php in IIS. sample php pages working fine. now i want to connect it to sql server i tried it by downloading a mssql .dll file in ext folder,I also tried by installing a extension for windows driver, then also it is not working. please help to sort out this issue. I am Using php5.3.19 for the same.
In order to use PHP 5.3 with SQL Server (2005 and above), you will need the Microsoft Drivers for PHP for SQL Server. There are two versions available: 2.0 and 3.0. 3.0 includes support for SQL Server 2012 and PHP 5.4.
You can find instructions for installing the dlls and interfacing with SQL Server in a TechNet article.
To install the extensions, you must move them into your ext folder and add a line to php.ini to load them, like the following:
extension=php_sqlsrv_53_nts_vc9.dll
Once this is done, restart the web server and load phpinfo in order to see if the extension has loaded. If it has loaded correctly, you should see a "sqlsrv" section in PHPInfo.
When the time comes for you to begin writing PHP that connects to SQL Server, make sure you have installed the native client. The current version is the SQL Server 2012 Native Client. References for the API are available on TechNet and PHP.net.
Finally, consider upgrading to PHP 5.4. The 3.0 versions of the drivers support 5.4 but the 2.0 versions do not; if you cannot install 3.0 on your system, you can find a 5.4-compatible version of the DLL (sqlsrv-5.4-nts-snap.zip or
sqlsrv-5.4-ts-snap.zip) on PHP.net. I have had good results with these versions.
I am running a LAMP server but now need to connect to MS SQL (client request). I have heard Microsoft has a driver, but can't verify if
Does anyone know if the Microsoft driver is available for Unix? If not, should I just stick with FreeTDS? This appears to be recommended by PHP, however install documentation seems lacking. Any direction on either would be greatly appreciated.
Sorry for the general question, I am not familiar with setting up PHP drivers.
UPDATE
Just for some back story, I am running an intranet from the LAMP server but needs to connect to a datasource on an external MS SQL DB Server (Windows of course). I am running PHP5.
FreeTDS is fine and works well enough. The Microsoft driver is Windows only, thus you wouldn't be able to use it on your Linux server.
First install FreeTDS and then configure PHP with --with-mssql=/prefix/used/for/freetds. If you are using your distribution's PHP, I'm sure there is a MS-SQL driver package already precompiled and available for installation (in Ubuntu, that'd be php5-sybase).
Then use PHP's mssql_* functions to actually do the work
For anyone who comes across this rather old question...
It should be noted that since 2010, Microsoft has actually developed a viable Linux driver for SQL Server that is installable via PECL. It's currently only compatible with PHP 7.
The main readme file is here, which lists some general and overly complicated installation instructions. But if you look at the latest release notes you will see that newer versions can be installed via PECL like so:
sudo pecl install sqlsrv
sudo pecl install pdo_sqlsrv