Narfの答えを拡張すると、これはOracle11.2で機能します。
<?php
function my_error_handler($errno, $errstr, $errfile, $errline) {
if (preg_match('/ORA-28002: [ a-zA-Z]*([0-9])+/', $errstr, $matches)) {
echo "Your password will expire within ${matches[1]} days\n";
}
}
set_error_handler("my_error_handler", E_WARNING);
$c = @oci_connect("hr", "welcome", "localhost/XE");
if (!$c) {
$m = oci_error();
echo "Connection failed: " . $m['message'] . "\n";
} else {
echo "Connected OK\n";
// Prove the connection is valid
$s = oci_parse($c, "select 'Query is OK' as c from dual");
oci_execute($s);
$r = oci_fetch_array($s, OCI_ASSOC);
echo $r['C'] . "\n";
}
restore_error_handler();
?>
猶予期間中のパスワードの出力は次のとおりです。
Your password will expire within 1 days
Connected OK
Query is OK