2021-01-20 08:37:47 +00:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
2021-09-28 10:27:17 +00:00
|
|
|
require_once __DIR__ . '/_bootstrap.php';
|
2021-01-20 08:37:47 +00:00
|
|
|
|
|
|
|
sqlsrv_connect(
|
|
|
|
'localhost, 50000',
|
|
|
|
[
|
|
|
|
'Authentication' => 'SqlPassword',
|
|
|
|
'ConnectRetryCount' => 0,
|
|
|
|
'Database' => 'example',
|
|
|
|
'LoginTimeout' => 1, // string for PDO_SQLSRV
|
|
|
|
'UID' => 'userName', // not for PDO_SQLSRV
|
|
|
|
'PWD' => 'password',
|
|
|
|
]
|
|
|
|
);
|
2021-08-26 07:24:53 +00:00
|
|
|
$rc = 0;
|
2021-01-20 08:37:47 +00:00
|
|
|
$errors = sqlsrv_errors(SQLSRV_ERR_ALL);
|
|
|
|
if (is_array($errors)) {
|
|
|
|
foreach ($errors as $error) {
|
|
|
|
if (isset($error['message']) && stripos($error['message'], 'This extension requires the Microsoft ODBC Driver for SQL Server') !== false) {
|
|
|
|
fwrite(STDERR, trim($error['message']) . "\n");
|
2021-08-26 07:24:53 +00:00
|
|
|
$rc = 1;
|
2021-01-20 08:37:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-26 07:24:53 +00:00
|
|
|
exit($rc);
|