Answer the question
In order to leave comments, you need to log in
Mysql data variables in wp-config for Heroku and Apache2 on locale?
There is Wordpress and Heroku. Set up variables for base configs in wp-config as in this article https://adiyatmubarak.wordpress.com/2017/01/20/dep...
// ** MySQL settings - You can get this info from your web host ** //
$url = parse_url(getenv('DATABASE_URL') ? getenv('DATABASE_URL') : getenv('CLEARDB_DATABASE_URL'));
/** The name of the database for WordPress */
define('DB_NAME', trim($url['path'], '/'));
/** MySQL database username */
define('DB_USER', $url['user']);
/** MySQL database password */
define('DB_PASSWORD', $url['pass']);
/** MySQL hostname */
define('DB_HOST', $url['host']);
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
define('AUTH_KEY', getenv('AUTH_KEY'));
define('SECURE_AUTH_KEY', getenv('SECURE_AUTH_KEY'));
define('LOGGED_IN_KEY', getenv('LOGGED_IN_KEY'));
define('NONCE_KEY', getenv('NONCE_KEY'));
define('AUTH_SALT', getenv('AUTH_SALT'));
define('SECURE_AUTH_SALT', getenv('SECURE_AUTH_SALT'));
define('LOGGED_IN_SALT', getenv('LOGGED_IN_SALT'));
define('NONCE_SALT', getenv('NONCE_SALT'));
Answer the question
In order to leave comments, you need to log in
You need .env support. Personally, I actively use Composer in WP development, there is a package " vlucas/phpdotenv " for this purpose ( small lesson ). As far as I know, it is impossible to do this with a regular wp plugin, since .env support must be available at the config level, long before the "plugins_loaded" event.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question