Unable to find wp-config settings

Unable to find DB_NAME, DB_USER, DB_PASSWORD, DB_HOST settings in the wp-config.php file because removed the following:

/** The name of the database for WordPress */
define( 'DB_NAME', 'local' );

/** MySQL database username */
define( 'DB_USER', 'root' );

/** MySQL database password */
define( 'DB_PASSWORD', 'root' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

I had to do this because I don’t consider it secure to use the wp-config.php as-is. In this way I use a wp-config.{environment}.php file that is not stored in version control. The site functions exactly as expected but the Local WP dashboard breaks with the following error on the Database tab, which also means that if I save this site as a blueprint then it will fail to configure any new site.

Unable to find DB_NAME settings in app/public/wp-config.php
Unable to find DB_USER settings in app/public/wp-config.php
Unable to find DB_PASSWORD settings in app/public/wp-config.php
Unable to find DB_HOST settings in app/public/wp-config.php

Can anyone explain why this is so unacceptable by the application? Is there not a way to a compromise here so that I can provide a secure method to my blueprint? For example I’m even willing to put this in the wp-config file and again it works as expected.

/** The name of the database for WordPress */
define( 'DB_NAME', getenv('DB_NAME') );

/** MySQL database username */
define( 'DB_USER', getenv('DB_USER') );

/** MySQL database password */
define( 'DB_PASSWORD', getenv('DB_PASSWORD') );

/** MySQL hostname */
define( 'DB_HOST', getenv('DB_HOST') );

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.