Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: How do I get PHP errors to display? #10172
    blankchannaveer-hakari
    Participant

    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);
                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.');
        }
    }
    
Viewing 1 post (of 1 total)