I want to configure a wordpress site for which my wp-config should take database values from Environment variables. I have set my environment variables but during it shows "Error establishing a database connection".
here is the code i am using
define('DB_NAME', getenv('DB'));
define('DB_USER', getenv('us'));
define('DB_PASSWORD', getenv('pa'));
define('DB_HOST', getenv('end'));
I have tried it running from terminal as well but error is same. I am not able to figure out what is causing this problem.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Database Error</title>
</head>
<body>
<h1>Error establishing a database connection</h1>
</body>
</html>
Is their something being missed??