Skip to content

Instantly share code, notes, and snippets.

@chihirokaasan
Created January 9, 2018 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihirokaasan/c8950fc86243eaa52e5700777e18d364 to your computer and use it in GitHub Desktop.
Save chihirokaasan/c8950fc86243eaa52e5700777e18d364 to your computer and use it in GitHub Desktop.
WordPress config.php Switch databases in production and testing environments
/** WordPress のためのデータベース名 */
/** テスト環境のHOST */
if($_SERVER["HTTP_HOST"] == "testURL.jp") {
define('DB_NAME', 'test_DB_Name');
/** MySQL データベースのユーザー名 */
define('DB_USER', 'DB_Test_User_Name');
/** MySQL データベースのパスワード */
define('DB_PASSWORD', 'Test_DB_PASSWD');
/** MySQL のホスト名 */
define('DB_HOST', '127.0.0.1');
} else {
define('DB_NAME', 'Production_DB_NAME');
/** MySQL データベースのユーザー名 */
define('DB_USER', 'DB_Production_User_Name');
/** MySQL データベースのパスワード */
define('DB_PASSWORD', 'Production_DB_PASSWD');
/** MySQL のホスト名 */
define('DB_HOST', '127.0.0.1');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment