jvv8
1849
4
Laravel

PDO Timeout with some servers

Posted 2 years ago by jvv8

I'm getting PDO timeout error: 'PDOException' with message 'SQLSTATE[HY000] [2002] Connection timed out' on some servers when accessing a Google Cloud SQL. All servers have been whitelisted. Regular old mysql_connect does work on all servers. database.php

        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', 'ip of the cloud sql'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'my_db'),
            'username' => env('DB_USERNAME', 'my_username'),
            'password' => env('DB_PASSWORD', 'my_password'),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

I have the laravel project running on 4 servers currently. PDO works on my local homestead PDO works on a Centos 7 Google Compute Instance PDO does not work on RHEL6 servers, but older pages with mysql_connect do work.

Please sign in or create an account to participate in this conversation.