PHP 7.0.6 Released

Introduction

Warning

This feature was REMOVED in PHP 7.0.0.

Alternatives to this feature include:

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.

User Contributed Notes

rjaehnrich at gmail dot com
12 days ago
to use MSSQL-connections on Linux with PHP7 you can use PDO with PDO_DBLIB.

Install driver using this command:
sudo apt-get install php7.0-sybase

then simply connect with this:

<?php
    $dsn
= "dblib:host=" . $host . ":1433;dbname=" . $database;
   
$dblink = new PDO ($dsn, $user, $pass);
?>

I got problems when i used the hostname, so i switched to the IP of the server.

Later I got problems to insert records into MSSQL-table.
This settings helped me out:

<?php
    $dblink
->exec("SET ANSI_WARNINGS ON");
   
$dblink->exec("SET ANSI_PADDING ON");
   
$dblink->exec("SET ANSI_NULLS ON");
   
$dblink->exec("SET QUOTED_IDENTIFIER ON");
   
$dblink->exec("SET CONCAT_NULL_YIELDS_NULL ON");
?>
alvaro at demogracia dot com
6 years ago
SQLSRV is not exactly a "driver": it's a completely different PHP extension to access SQL Server databases and it has its own syntax and features. It's a Windows-only library developed and maintained by Microsoft and it's not related to the built-in SQL Server extension described here.

(Whatever, it's quite feature-rich and it's easy to learn.)
To Top