Welcome Guest, Not a member yet? Register   Sign In
How to activate debugging role wise?
#1

(This post was last modified: 10-16-2021, 11:33 PM by sr13579.)

For a live project how can I hide debugging feature for normal user?
I just want to show it only for developers.
Please give me a solution.
Reply
#2

Set your environment to `production`.
See https://codeigniter4.github.io/CodeIgnit...t-constant
Reply
#3

(10-16-2021, 06:04 PM)kenjis Wrote: Set your environment to `production`.
See https://codeigniter4.github.io/CodeIgnit...t-constant

This is not how it is done I guess. I need to show it to only certain role. Like admin for example.
Reply
#4

(10-16-2021, 04:47 PM)sr13579 Wrote: For a live project how can I hide debugging feature for normal user?
I just want to show it only for developers.
Please give me a solution.

app/Config/Boot/production.php
PHP Code:
<?php

/*
 |--------------------------------------------------------------------------
 | ERROR DISPLAY
 |--------------------------------------------------------------------------
 | Don't show ANY in production environments. Instead, let the system catch
 | it and display a generic error message.
 */
ini_set('display_errors''0');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);

/*
 |--------------------------------------------------------------------------
 | DEBUG MODE
 |--------------------------------------------------------------------------
 | Debug mode is an experimental flag that can allow changes throughout
 | the system. It's not widely used currently, and may not survive
 | release of the framework.
 */

if (is_developer()) {
    defined('CI_DEBUG') || define('CI_DEBUG'true);
} else {
    defined('CI_DEBUG') || define('CI_DEBUG'false);

Reply
#5

You can also try this out, but make sure you read it on php.net.

PHP Code:
$ciEnv 'development';

putenv("CI_ENVIRONMENT=$ciEnv"); 

READ:
PHP.net - putenv
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB