mirror of
https://github.com/danog/docker-php-extension-installer.git
synced 2024-12-12 17:37:34 +01:00
29 lines
778 B
Plaintext
29 lines
778 B
Plaintext
|
#!/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);
|
||
|
}
|
||
|
}
|