Support the ongoing development of Laravel.io →
Configuration Database

Hi,

i'm having an issue connecting my EC2 instance to the Amazon RDS db instance. Please note I'm using PHP v7.0, running on nginx v1.10.0

In my database.php I have the following:

--- snip ---

'mysql' => [ 'driver' => 'mysql',
'host' => env('DB_HOST', 'xxxx-xxx.xxxxxxxxxxx.us-east-1.rds.amazonaws.com'), 'port' => env('DB_PORT', 3306), 'database' => env('DB_DATABASE', 'mydatabase'), 'username' => env('DB_USERNAME', 'myusername'), 'password' => env('DB_PASSWORD', 'mypassword'), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ],

--- snap ---

When I connect to the DB remotely, from the command line with the mysql command it works like a charm - with the above, I keep getting:

--- snip ---

[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[HY000] [2002] Connection refused

[PDOException]
SQLSTATE[HY000] [2002] Connection refused

--- snap ---

This is my output for php -m:

--- snip ---

$ php -m [PHP Modules] bcmath bz2 calendar Core ctype curl date dba dom exif fileinfo filter ftp gettext hash iconv json libxml mbstring mcrypt memcache mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl Zend OPcache zip zlib

[Zend Modules] Zend OPcache

--- snap ---

Help would be greatly appreciated.

Thanks.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

9thzero 9thzero Joined 3 Apr 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.