0

My laravel project is getting error every morning, and after some time it becomes okay. I don't understand what is the issue.

I googled it and see some similar issues. But it does not resolve my issue.

db version is 5.1.1
3

1 Answer 1

1

Enable the ATTR_EMULATE_PREPARES of PDO (disabled by default at Laravel) for resolve the problem. Just insert the option config:

'options'   => [
        \PDO::ATTR_EMULATE_PREPARES => true
       ]

For example

  'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'database'  => env('DB_DATABASE', 'forge'),
        'username'  => env('DB_USERNAME', 'forge'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
        'options'   => [
            \PDO::ATTR_EMULATE_PREPARES => true
        ]
    ],
1
  • 1
    I saw this answer but their they mention it is not proper solution for this. It is just temporary solution Commented Dec 4, 2017 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.