Question

I'm using Laravel 4 with CentOS 5 and PHP 5.4. When i try to run a query, i got this:

PDOException
SQLSTATE[HY000] Attempt to set unknown LOGINREC field (severity 7)

Just a simple query like : User::find(1); (with Eloquent ORM).

My FreeTDS Configuration:

[myconf]
        host = 172.30.1.24
        # tried with port 1433 and 1453
        port = 1453
        # tried with tds 8.0 and 7.0
        tds version = 7.2

Laravel Database Config:

            ....
            'sqlsrv' => array(
                    'charset'  => 'iso-8859-1',
                    'driver'   => 'sqlsrv',
                    'host'     => 'myconf',
                    'database' => 'mydb',
                    'username' => 'myuser',
                    'password' => 'mypass',
                    'prefix'   => '',
            ),

When i run "tsql -C":

Compile-time settings (established with the "configure" script)
                            Version: freetds v0.82
             freetds.conf directory: /etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes

php -v

PHP 5.4.23 (cli) (built: Dec 11 2013 06:57:28) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.4.4, Copyright (c) 2002-2013, by ionCube Ltd., and
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
Was it helpful?

Solution

Solved

  1. Install new Freetds
  2. Configure freetds.conf
  3. Reinstall php-mssql using remi repo (yum --enablerepo=remi install php-mssql)
  4. Restart apache

    • dblib is enabled and working as expected.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top