msphpsql: ATTR_ERRMODE exception is not supported

Hello,

Converting a running Laravel app on Windows to run under PHP 7 + Sql Server driver for Linux.

When PDO::ATTR_ERRMODE is set to PDO::ERRMODE_EXCEPTION I get this error:

SQLSTATE[IMSSP]: An unsupported attribute was designated on the PDO object.

This is supported in PDO_SQLSRV for Windows but not as it seems for linux…

I’m running CentOS 7, PHP 7.0.14, Apache 2.4.6

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Hello,

Converting a running Laravel app on Windows to run under PHP 7 + Sql Server driver for Linux.

When PDO::ATTR_ERRMODE is set to PDO::ERRMODE_EXCEPTION I get this error:

SQLSTATE[IMSSP]: An unsupported attribute was designated on the PDO object.

This is supported in PDO_SQLSRV for Windows but not as it seems for linux…

I’m running CentOS 7, PHP 7.0.14, Apache 2.4.6

for me

My project is using iis php8.2.9 lavarel 10 mssql. It is had this issue. I use xdebug for look at the process. I find \vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServerConnector.php line 19 PDO::ATTR_STRINGIFY_FETCHES => false. It will appear error and cross off it . it is fix.

My all day… QQ

Instead of editing the vendor file, i created a custom connector php 8.1 and Laravel 10

namespace App\Database\Connectors;

use Illuminate\Database\Connectors\SqlServerConnector as BaseSqlServerConnector;

class SqlServerConnector extends BaseSqlServerConnector
{
    public function createConnection($dsn, array $config, array $options)
    {
        // Remove the PDO::ATTR_STRINGIFY_FETCHES option
        unset($options[\PDO::ATTR_STRINGIFY_FETCHES]);

        return parent::createConnection($dsn, $config, $options);
    }
}

Hello, Converting a running Laravel app on Windows to run under PHP 7 + Sql Server driver for Linux. When PDO::ATTR_ERRMODE is set to PDO::ERRMODE_EXCEPTION I get this error: SQLSTATE[IMSSP]: An unsupported attribute was designated on the PDO object. This is supported in PDO_SQLSRV for Windows but not as it seems for linux… I’m running CentOS 7, PHP 7.0.14, Apache 2.4.6

for me My project is using iis php8.2.9 lavarel 10 mssql. It is had this issue. I use xdebug for look at the process. I find \vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServerConnector.php line 19 PDO::ATTR_STRINGIFY_FETCHES => false. It will appear error and cross off it . it is fix. My all day… QQ

yes this fixed the issue but we can’t change vendor directory so why this issue accuored and how to fixed it permanently !!

@umehmood124 you can do this. I’ve tested that solution myself, and it worked like a charm.

Thanks That Worked !!

Hello, Converting a running Laravel app on Windows to run under PHP 7 + Sql Server driver for Linux. When PDO::ATTR_ERRMODE is set to PDO::ERRMODE_EXCEPTION I get this error: SQLSTATE[IMSSP]: An unsupported attribute was designated on the PDO object. This is supported in PDO_SQLSRV for Windows but not as it seems for linux… I’m running CentOS 7, PHP 7.0.14, Apache 2.4.6

for me

My project is using iis php8.2.9 lavarel 10 mssql. It is had this issue. I use xdebug for look at the process. I find \vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServerConnector.php line 19 PDO::ATTR_STRINGIFY_FETCHES => false. It will appear error and cross off it . it is fix.

My all day… QQ

Thanks, I commented this line and problem solved 😃