私が取り組んでいるサーバーはphp 5.5を実行しており、FreeTDS dblibがインストールされています。
php -v
戻り値;
PHP 5.5.0-dev (cli) (built: Oct 23 2012 15:41:58)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
ビルドはそのままです。
Configure Command => './configure' '--with-apxs2=/usr/bin/apxs2' '--enable-track-vars' '--with-mssql' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-zlib-dir=/usr' '--enable-ftp' '--with-gd' '--enable-freetype-4bit-antialias-hack' '--with-config-file-path=/etc' '--enable-calendar' '--with-curl' '--with-curlwrappers' '--enable-exif' '--with-mysql' '--with-ldap' '--with-freetype-dir=/usr' '--enable-sockets' '--with-pdo-mysql' '--enable-soap' '--with-mcrypt' '--with-pdo-dblib' '--with-openssl' '--enable-sysvsem' '--enable-shmop' '--enable-pcntl' '--with-xsl'
次のようにSQL Serverボックスに接続しようとしています。
<?php $pdo = new PDO ('dblib:host=fqdn,port;dbname=db', 'usr', 'passwd'); ?>
出力は次のとおりです。
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[] (null) (severity 0)' in /path/to/file.php:17 Stack trace: #0 /path/to/file.php(17): PDO->__construct('dblib:host=fqdn...', 'usr', 'passwd') #1 {main} thrown in /path/to/file.php on line 1
これに関する既存のスタック投稿をかなりの量検索した結果、それらはすべて 5.2 RC 以降の PHP のバグ修正、または FreeTDS の以前のバージョンに関連しています。このサーバーが 5.5 であり、それ以降のバージョンの FreeTDS を使用していることを考えると、この非常に役立つ空の SQL 状態エラー メッセージに対する回答があるかどうか疑問に思いました。
興味深いことに、FreeTDS のインストールを確認するためのガイドに従うと、実行に失敗したコマンドが提案されます。FreeTDS の再インストールを試みます。