PHP Constants

PHP constants store fixed values that remain the same throughout your site. They are automatically global, which is ideal for values that need to be accessed in multiple places.

If you use a non-standard WordPress setup, such as Bedrock or Trellis, Kinsta may not be able to locate the DB_PASSWORD variable and, therefore, is unable to update the database password when you:

  • Add a new site by cloning an existing environment
  • Add a staging environment by cloning an existing environment
  • Push staging to live
  • Restore a backup
  • Change the database password in MyKinsta

To resolve this issue, Kinsta provides the SERVER_SECRET_DB_PASSWORD PHP constant for use on the Kinsta servers. When you define this constant within the config.php file, MyKinsta uses it to identify your site’s database password. You can define it as follows:

define('DB_PASSWORD', defined('SERVER_SECRET_DB_PASSWORD') ? SERVER_SECRET_DB : 'asdijfhkjasdbfkjhbajiksd' );

You can define the following PHP constants to use with Kinsta servers:

  • SERVER_SECRET_DB_USER
  • SERVER_SECRET_DB_PASSWORD
  • SERVER_SECRET_DB_HOST
  • SERVER_SECRET_DB_NAME

For example, you can define the constants in the config.php file as follows:

define('DB_NAME', defined('SERVER_SECRET_DB_NAME') ? SERVER_SECRET_DB_NAME : 'newsitetest');
define('DB_USER', defined('SERVER_SECRET_DB_USER') ? SERVER_SECRET_DB_USER : 'newsitetest');
define('DB_PASSWORD', defined('SERVER_SECRET_DB_PASSWORD') ? SERVER_SECRET_DB : 'asdijfhkjasdbfkjhbajiksd' );
define('DB_HOST', defined('SERVER_SECRET_DB_HOST') ? SERVER_SECRET_DB_HOST : 'localhost');

Alternatively, you can define the constants as follows:

define('DB_NAME',SERVER_SECRET_DB_NAME);
define('DB_USER',SERVER_SECRET_DB_USER);
define('DB_PASSWORD',SERVER_SECRET_DB_PASSWORD);
define('DB_HOST',SERVER_SECRET_DB_HOST);
Was this article helpful?

© 2013 - 2025 Kinsta Inc. All rights reserved. Kinsta®, MyKinsta®, and DevKinsta® are trademarks owned by Kinsta Inc.The WordPress® trademark is the intellectual property of the WordPress Foundation, and the Woo® and WooCommerce® trademarks are the intellectual property of WooCommerce, Inc. Uses of the WordPress®, Woo®, and WooCommerce® names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation or WooCommerce, Inc. Kinsta is not endorsed or owned by, or affiliated with, the WordPress Foundation or WooCommerce, Inc. Legal information