2013-10-22 2 views
3

서버에서 현재 실행중인 php 5.5이고 FreeTDS dblib이 설치되어 있습니다.'SQLSTATE [] (null) (심각도 0)'메시지가있는 PDOException '

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 서버 상자에 연결을 시도하고있다;

<?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를, 또는 FreeTDS를 이전 버전 이후 PHP에 대한 버그 수정과 관련이있다. 이 서버가 5.5이고 이후 버전의 FreeTDS를 사용하면이 유용한 SQL 상태 오류 메시지에 대한 답이있는 사람이 있는지 궁금해졌습니다.

흥미롭게도 guide to confirming your FreeTDS installation 다음에 나오는 명령은 나를 위해 실행되지 않는 명령을 나타냅니다. 나는 FreeTDS의 재설치를 시도 할 것이다.

답변

5

그래서 포트 양식에 영향을 미치는 곳에서 연결하고있는 것으로 보입니다.

Windows 기반 서버에서 PHP를 사용하는 경우 연결 문자열은 다음과 같아야합니다.

<?php $pdo = new PDO ('dblib:host=fqdn,port;dbname=db', 'usr', 'passwd'); ?> 

Linux 기반 서버에서 PHP를 사용하는 경우 연결 문자열은;

나는 FQDN/포트 차이를 가정했다
<?php $pdo = new PDO ('dblib:host=fqdn:port;dbname=db', 'usr', 'passwd'); ?> 

은 TO가 아닌 상황에서 연결 기반으로했다.

그럼에도 불구하고,이 시스템의 오류 처리에는 분명히 많은 생각이 들지 않았습니다!

관련 문제