Welcome Guest, Not a member yet? Register   Sign In
Development mode for personal IP address
#6

(04-20-2022, 02:02 AM)datamweb Wrote:
(04-19-2022, 04:21 AM)5flex Wrote: Hello everyone! Sorry for my bad English, but I try to write my question.
Tell me please, How I can set (or switch on) CI_ENVIRONMENT to DEVELOPMENT mode for my personal IP address?
As example... I have a working web project and I have a bug on any page and I want to switch on development mode, BUT! If I will change .env file and will set development mode this parameter will be set for all clients on my web site. How I can set something:

if($_SERVER['REMOTE_ADDR'] == '12.34.56.78') {
env(' CI_ENVIRONMENT', 'development')
}
I will believe would your understood my question. Thank's!

Hi, Just replace the following code in file app\Config\Boot\production.php.
Code:
<?php

    $yourStaticIP = '::1';
    if(\Config\Services::request()->getIPAddress() == $yourStaticIP){

        error_reporting(-1);
        ini_set('display_errors', '1');

        defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);

        defined('CI_DEBUG') || define('CI_DEBUG', true);
   
    }
/*
|--------------------------------------------------------------------------
| 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.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

Note this:
1. Enter your IP in section
Code:
$yourStaticIP = '::1';
.
2. Your IP is dynamic so your IP changes when you turn off the modem. In this case, replace it again.

Enjoy!


Awesome!!!!! Very big thank you!!!!!
Reply


Messages In This Thread
RE: Development mode for personal IP address - by 5flex - 04-20-2022, 04:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB