PDOException with the message "SQLSTATE [] (null) (severity 0)"

The server I'm running on is running php 5.5, and it has FreeTDS dblib installed.

php -v returns;

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

The design itself;

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'

I am just trying to connect to a SQL Server mailbox with the following:

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

The output is as follows:

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

Having done my large amount of searching for existing stack entries, they are all related to bug fixes for PHP with 5.2 RC or earlier versions of FreeTDS. Given that this server is 5.5, and with a later version of FreeTDS, I wondered if anyone had an answer to this very useful SQL status error message.

Interestingly, the guide to confirm the installation of FreeTDS offers commands that do not work for me. I will try to reinstall FreeTDS.

+3
1

, , , .

PHP Windows :

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

PHP Linux :

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

, fqdn/port TO, FROM.

, !

+5

Source: https://habr.com/ru/post/1627942/


All Articles