Skip to main content

Debug wp-config.php Settings

Home Forums WordPress Config Setup Debug wp-config.php Settings

Viewing 1 reply thread
  • Author
    Posts
    • #2392

      Layer7web
      Keymaster

      Useful debug settings for the wp-config.php file:

      define(‘WP_DEBUG’, true); – Turn on warnings and notices.

      define(‘WP_DEBUG_LOG’, true); – Log those warnings and notices to wp-content/debug.log

      define(‘WP_DEBUG_DISPLAY’, false); – Don’t display them just log them to debug.log. (Publicly accessible if location is not changed)

      ini_set( 'log_errors', 1 );
      ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
      • This topic was modified 9 years, 7 months ago by Layer7web. Reason: Added change location of debug.log file
      • This topic was modified 9 years, 7 months ago by Layer7web.
    • #2697

      Layer7web
      Keymaster

      To use the same config file for different environments I have been using this a lot these days:

      if(strpos($_SERVER['HTTP_HOST'], 'local') === false){
      	define('DB_NAME', 'database_name');
      	define('DB_USER', 'username');
      	define('DB_PASSWORD', 'password');
      	define('WP_DEBUG', false);
      	
      	/** WP Memory Limit */
      	define('WP_MEMORY_LIMIT', '1024M');
      	
      	/** Limit number of post revisions */
      	define( 'WP_POST_REVISIONS', 5);
      
      	/** Turn Off PHP Error Reporting */
      	error_reporting(0);
      	@ini_set(‘display_errors’, 0);
      }
      
      if(strpos($_SERVER['HTTP_HOST'], 'local') >= 0){
      	define('DB_NAME', 'database_name');
      	define('DB_USER', 'user_name');
      	define('DB_PASSWORD', 'password');
      	define('WP_DEBUG', true);
      }

      Putting development connection settings in the ‘local’ and live settings in the not ‘local’.

Viewing 1 reply thread

You must be logged in to reply to this topic.