mirror of
https://github.com/danog/docker-php-extension-installer.git
synced 2024-11-27 04:24:46 +01:00
66fa5885ac
Test: sqlsrv, pdo_sqlsrv
29 lines
778 B
PHP
Executable File
29 lines
778 B
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
|
|
error_reporting(-1);
|
|
|
|
set_error_handler(
|
|
static function ($errno, $errstr, $errfile, $errline) {
|
|
$msg = "Error {$errno}: {$errstr}\n";
|
|
if ($errfile) {
|
|
$msg .= "File: {$errfile}\n";
|
|
if ($errline) {
|
|
$msg .= "Line: {$errline}\n";
|
|
}
|
|
}
|
|
fwrite(STDERR, $msg);
|
|
exit(1);
|
|
},
|
|
-1
|
|
);
|
|
|
|
try {
|
|
new PDO('sqlsrv:server=localhost; Authentication=SqlPassword; ConnectRetryCount=0; Database=example; LoginTimeout=1', 'userName', 'password');
|
|
} catch (PDOException $x) {
|
|
if (stripos($x->getMessage(), 'This extension requires the Microsoft ODBC Driver for SQL Server') !== false) {
|
|
fwrite(STDERR, trim($x->getMessage() . "\n"));
|
|
exit(1);
|
|
}
|
|
}
|