I would usually go with the following code in my plain PHP projects.
if(!defined('ENVIRONMENT')){ define('ENVIRONMENT', 'DEVELOPMENT'); } $base_url = null; if (defined('ENVIRONMENT')) { switch (ENVIRONMENT) { case 'DEVELOPMENT': $base_url = 'http://localhost/product/'; ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL|E_STRICTE_ALL); break; case 'PRODUCTION': $base_url = 'Production URL'; /* https://google.com */ error_reporting(E_ALL); ini_set('display_errors', 0); ini_set('display_startup_errors', 0); ini_set('log_errors', 1); /*/ Mechanism to log errors */ break; default: exit('The application environment is not set correctly.'); } }