mssql_connect no longer working as of PHP 5.3 - php

I just received an email from our host and they've upgraded our PHP to 5.3, unfortunately though, all the scripts have now broken. I traced it down to the function mssql_connect failing. Support told me this has now been deprecated under 5.3 - how can this be true?
How can you connect to a mssql database under PHP 5.3 now??

http://www.php.net/manual/en/intro.mssql.php
"This extension is not available anymore on Windows with PHP 5.3 or later."
Maybe you should look into converting your app to use PDO:
http://www.php.net/manual/en/ref.pdo-sqlsrv.php

If you see such a warning, the first place to visit is the PHP documentation.
From http://php.net/manual/en/intro.mssql.php:
Introduction
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 driver for MS SQL is available from Microsoft:
ยป http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx.

Related

Should I use PHP's SQLSRV Functions?

I am starting a new project in PHP that need to access MS Sql Server.
I know that PHP's manual lacks of warns about old or even deprecated set of functions.
MySQL extension do not refer to MySQLi extension at any point.
SQLite extension do not refer to SQLite3 extension at any point.
So my question is: Am I OK using PHP's SQLSRV Functions? or they are not the state of the art? I did choose them because aparently they have MS support.
Please notice that I am not asking for a recomendation, just if what I choose is OK
As I understand it the SQLSRV functions aren't actually PHP's per se since they are part of a package maintained by Microsoft outside the main PHP project. They are however one of the two best bets for working with MS SQL Server (PDO_SQLSRV being the other) since they are currently maintained.
They are both currently Windows only.

Connecting to SQL server database with PHP and Windows drivers

I was trying to connect to a Microsoft SQL Database with PHP using the mssql set of functions that WERE in php. Since I am using php 5.5, these functions are deprecated I think, but I read that there is a solution, which is downloading the drivers windows is providing. I downloaded and installed them from the following link:
https://www.microsoft.com/en-us/download/details.aspx?id=20098
Now the only thing is unclear to me is how to use them. Do these drivers re-activate the mssql (which I am sure it is not the case since I tried the code using mssql_connect and it threw a php error saying that the function could not be found)?
Can anybody give me an example of a MSSQL connection with these drivers?
Thanks a lot for your time and help!
Cheers!

Upgraded from PHP 5.3 to PHP 5.6.5 and now no php_oci8.dll

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?!

Working with MS SQL SERVER on PHP5.6

So I have a trouble here. Tried use mssql_connect() but interpeter says that function is undefinied. PHP.net advices this, but it suppports only older versions of PHP. Is it possible to connect to MS SQL Server database from PHP5.6? What extensions should I add, what functions can I use?
Configuration details: localhost, Apache 2.4, PHP 5.6, OS Windows 8.
You need to enable the MSSQL extension in the PHP.ini file.
If this extension is not installed, you need to install it in PHP.
Please tell your server details (OS/WebServer like apache nginx) so that I can explain in detail.
Use
<?php phpinfo();?>
to see what are available with your php installation. I advice you to use PDO instead of mysql_* functions. It supports several databases not only MSSQL or MySQL.

mssql_connect in PHP does not exist

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.

Categories