I am working on a project using laravel and deploy it to openshift via git.
When I worked on my local computer, everything is alright. Then I tried to deploy my project in openshift. After succeed configure and deploy my app in the openshift, then I run the application in my local computer but the configuration didn't work. Below is the error message:
PDOException in Connector.php line 47: SQLSTATE[28000] [1045] Access denied for user 'user'@'localhost' (using password: NO)
here's my database.php
'default' => 'mysql',
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => getenv('OPENSHIFT_MYSQL_DB_HOST'),
'port' => getenv('OPENSHIFT_MYSQL_DB_PORT'),
'database' => getenv('OPENSHIFT_APP_NAME'),
'username' => getenv('OPENSHIFT_MYSQL_DB_USERNAME'),
'password' => getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
]
],
'migrations' => 'migrations',
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
and this is my .env
APP_ENV=local
APP_DEBUG=true
APP_KEY=5XfZXUrDIbmZkIqAgSdOPuYMzSub9DUv
DB_HOST=localhost
DB_DATABASE=dbname
DB_USERNAME=root
DB_PASSWORD=password
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
I am using laravel 5. I am sure that the problem is about the configuration. but I have no idea where should I change the configuration. I think Laravel should read a configuration in .env file for specific DB_HOST, Right?. How do I fix the configuration?
Thank you for advance!