Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hexblot/mssql-compat
Small drop-in wrapper for PDO that emulates the deprecated mssql_* functions, and allows legacy software to work in PHP7+
https://github.com/hexblot/mssql-compat
mssql pdo-dblib php7 wrapper
Last synced: about 2 months ago
JSON representation
Small drop-in wrapper for PDO that emulates the deprecated mssql_* functions, and allows legacy software to work in PHP7+
- Host: GitHub
- URL: https://github.com/hexblot/mssql-compat
- Owner: hexblot
- License: apache-2.0
- Created: 2016-10-05T13:28:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-07T09:48:37.000Z (almost 6 years ago)
- Last Synced: 2024-09-18T10:53:22.097Z (4 months ago)
- Topics: mssql, pdo-dblib, php7, wrapper
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MSSQL-Compat
MSSQL Compat is a small and simple drop-in library that allows your pre-7 PHP project, that uses MSSQL via mssql_* functions ( eg mssql_connect() et al ), to work transparently with PDO DBLib by providing the missing functions as wrappers around the equivalent PDO syntax - and all that with a single line!
## The story
I recently started migrating internal web applications to new servers that use PHP7.
Thus I stumbled on a couple of old applications that use MSSQL with PHP, which I dearly hoped to avoid rewriting and debugging now that PHP7 has deprecated the mssql_* family of functions.
*The result* is this single-file solution: just include it before your first mssql_* call, and it will transparently wrap them to the equivalent PDO calls.
## What it is ***not***
- This library is *not* a security enhancement by any measure. It assumes that your program logic escapes what needs to be escaped, since you cannot benefit from PDO goodness without changing the function syntax.
- That being said, kindly let me know if you can provide better security in the given code.
- It is **not** meant as a means to develop new software in PHP7 using mssql_* functions - use PDO or similar!## Requirements
MSSQL-Compat requires the bare basics for PHP7 to be able to talk to MSSQL - namely:
- [PHP7]
- [PDO] ( usually via the php-pdo package )
- [PDO DBLib] installed> *Hint*: All of the above are easily usable via repos such as [IUS] or [Remi]
## How to use
### Option A: Manually
Just download and add an include to this library on the top of the old application `index.php` file.
```php
[PDO]:
[PDO DBLib]:
[IUS]:
[Remi]: