I've been struggling with this for a while now and I don't know what I'm missing. The error is:
call to undefined function mssql_connect()
Having looked into it already, I've done about everything I can.
I moved the php.ini file to c:\windows
In the ini I changed the extension_dir directive to c:PHP\ext and uncommented:
extension = php_mssql.dll
I moved the dll file to c:windows\system32\
I downloaded the 200.80.194.0 version of ntwdblib.dll and placed it in c:\windows\system32
I restarted my web server client
PHP is still not recognizing the function and library classes. I'm stumped as to what I didn't do right and would love some help. If it's helpful, I'm running PHP 5.3.2, IIS, and Microsoft SQL Server 2008.
For SQL Server 2008 on Windows it's sqlsrv_connect This is because Microsoft now uses the SQL Driver for PHP which is now on version 2.0 I believe.
Also it's worth noting that with sqlsrv_query, and mssql_query they switched the parameters around (spent half an hour figuring that out).
You say you are running PHP 5.3.2. The PHP manual states:
This extension is not available anymore on Windows with PHP 5.3 or later.
The PHP MSSQL library is ancient and is no longer considered a viable option.
You should instead examine PDO with either the MSSQL driver or the more reliable ODBC driver.
Microsoft are still developing their own PDO driver. Version 2 was made available June 2010. Microsoft recommend the more stable version 1.1 for production use.
Related
I use php_oci8.dll in our application to access an Oracle 8 database server. I upgraded our PHP version from 5.3 to 5.6.5 and now there is no php_oci8.dll in the ext/ folder.
Can I just copy it from the old version?
php_oci8.dll is a very old library used with very old version of Oracle
Now there is a newer version for this library, like php_oci8_11g
The question is : what is the version of Oracle that you use ?
From http://php.net/manual/en/oci8.requirements.php
The OCI8 1.4 extension is included with PHP 5.3, PHP 5.4 and PHP 5.5. It is also available from PECL.
Read: not incliuded in PHP 5.6 (which is a good thing, not pulling in every single DB interface into the main tree)
Just download that stuff from PECL.
You might need to rebuild it from source, though, if whatever Oracle DB client Libraries you use don't match the needs of the OCI8 in its current version
EDIT: Don't do this, OP. Are you really using Oracle 8i? That has seen its last update in 2003 and should not be used for security reasons, any more. Seriously, how do you even run this on a modern Operating system? Or do you have a Windows XP machine running as a server exposed to the internet somewhere?!
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 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 have been trying to install SQL Server drivers for my wamp server 32 bit ( php ver 5.3.13 ) and I downloaded the drivers from Microsoft download site I copied them to ext folder and changed the php.ini file but I'm still getting errors. Could you please give me a full installation manual I really need to sort this out and start developing some codes on this.
Could you not use PDO this would solve your issues? http://www.php.net/manual/en/ref.pdo-dblib.php
EDIT:
Download SQL driver for PHP - http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx and http://www.microsoft.com/en-us/download/details.aspx?id=20098
I am currently trying to connect to my localdb on MSSQL 2012 Express.
I have downloaded and installed the official microsoft driver from http://www.microsoft.com/en-us/download/details.aspx?id=20098
I get some kind of SQLSRV section in my phpinfo(). But when I try to create a new PDO object it says it does not have the driver. Which I could understand since it is not mentioned on the phpinfo() PDO section, but it has its own section + the get_loaded_extensions also shows sqlsrv. I suppose thats from the official MS Driver ? I am using the php_sqlsrv_53_nts.dll
With my Zend Server CE 5.6 with PHP 5.3.9
Now as far as I understood I downloaded the wrong driver and should try the one that is brought by the PECL manager? There is only the sourcecode available and obviously I am on a windows machine so I can forget about everything that I need to compile myself - I am actually getting the suffix errors when using the powershell and my pecl / pear installation.
Has anybody solve that problem ? Any help much appreciated
All the best,
Richard
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).
//edit: just read you latest comment. This extension is available for a very long time now and can be considered working. If you are not allowed to use it you must rewrite your code to use the functions the native driver offers for PHP.
Another possibility is to use the odbc drivers which are by default included in the php extensions, you still might have to uncomment them in your php.ini though.
extension=php_pdo_odbc.dll
Don't forget to restart your server afterwards ;-)
And then use it like this:
$db = new PDO('odbc:Driver={SQL Server};Server=192.168.x.x;Database=DatabaseName; Uid=User;Pwd=Password');
$stmt = $db->query("SELECT the_usual FROM aTable WHERE all='well'");
Alright. I suppose its just one of these days.
I got the wrong extension loaded from the supplied ones by MS. I needed to use php_pdo_sqlsrv_53_nts
rather than
php_sqlsrv_53_nts
Thanks for all the help