Skip to content

Instantly share code, notes, and snippets.

@franz-josef-kaiser
Created March 7, 2011 21:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save franz-josef-kaiser/859325 to your computer and use it in GitHub Desktop.
Save franz-josef-kaiser/859325 to your computer and use it in GitHub Desktop.
Example from wp_config.php (wordpress config file) that shows different environments
/**
* Production, Staging, Live
*/
define( 'OXO_LOCAL_A', '/wordpress/' );
define( 'OXO_STAGE', 'some-stage.domain.com' );
if ( substr($_SERVER['REQUEST_URI'], 0, 11) == OXO_LOCAL_A )
{
// DB
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'loginlocal' );
define( 'DB_PASSWORD', 'passlocal' );
define( 'DB_HOST', 'localhost' );
// URL Constants
define( 'WP_SITEURL', 'http://localhost/wordpress' );
define( 'WP_HOME', 'http://localhost/wordpress' );
define( 'AUTOSAVE_INTERVAL', 3600 ); // autosave 1x per hour
define( 'EMPTY_TRASH_DAYS', 0 ); // zero days
define( 'WP_POST_REVISIONS', false ); // no revisions
// DEBUG
#error_reporting( E_ALL );
define( 'WP_DEBUG', true );
define( 'SAVEQUERIES', true );
define( 'WP_DEBUG_LOG', true ); // file: /core_root/wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
// ALLOW updates without FTP
define ( 'FS_METHOD', 'direct' );
}
elseif ( $_SERVER['HTTP_HOST'] == OXO_STAGE )
{
define( 'DB_NAME', 'dbnamestage' );
define( 'DB_USER', 'loginstage' );
define( 'DB_PASSWORD', 'passstage' );
define( 'DB_HOST', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
define( 'WP_HOME', 'http://example.com' );
define( 'AUTOSAVE_INTERVAL', 3600 ); // autosave 1x per hour
define( 'EMPTY_TRASH_DAYS', 0 ); // zero days
define( 'WP_POST_REVISIONS', false ); // no revisions
// DEBUG
# error_reporting( E_ALL ); // in case we need it
define( 'WP_DEBUG', true );
define( 'SAVEQUERIES', true );
define( 'WP_DEBUG_LOG', true ); // file: /core_root/wp-content/debug.log
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
// Non-public
mysql_query( 'UPDATE wp_options SET option_value = false WHERE option_name = "blog_public"' );
}
// Catch all assumes you're using DEV
else
{
define( 'DB_NAME', 'dbnamelive' );
define( 'DB_USER', 'loginlive' );
define( 'DB_PASSWORD', 'passlive' );
define( 'DB_HOST', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
define( 'WP_HOME', 'http://example.com' );
define( 'AUTOSAVE_INTERVAL', 300 ); // autosave 1x per 5 min
define( 'EMPTY_TRASH_DAYS', 30 ); // 30 days
define( 'WP_POST_REVISIONS', 5 ); // 5 Revisions per post
// DEBUG
# error_reporting(E_ALL); // in case we need it
define( 'WP_DEBUG', false );
// Public
# mysql_query( 'UPDATE wp_options SET option_value = true WHERE option_name = "blog_public"' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment