note 119206 added to intro.mssql
| From: | rjaehnrich at gmail dot com | Date: | Tue, 19 Apr 2016 09:31:53 +0000 |
| Subject: | note 119206 added to intro.mssql | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205275@lists.php.net to get a copy of this message | ||
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");
?>
----
Server IP: 72.52.91.14
Probable Submitter: 62.159.27.1
----
Manual Page -- http://php.net/manual/en/intro.mssql.php
Edit -- https://master.php.net/note/edit/119206
Del: integrated -- https://master.php.net/note/delete/119206/integrated
Del: useless -- https://master.php.net/note/delete/119206/useless
Del: bad code -- https://master.php.net/note/delete/119206/bad+code
Del: spam -- https://master.php.net/note/delete/119206/spam
Del: non-english -- https://master.php.net/note/delete/119206/non-english
Del: in docs -- https://master.php.net/note/delete/119206/in+docs
Del: other reasons-- https://master.php.net/note/delete/119206
Reject -- https://master.php.net/note/reject/119206
Search -- https://master.php.net/manage/user-notes.php