-
5flex Junior Member
 
-
Posts: 30
Threads: 11
Joined: Sep 2019
Reputation:
2
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!
the lateral thinking mode is this : you have your web set up on local host . thats where you play with it , fix bugs and improve it. on that one you have development mode. your live web is a clone of your dev web on local host, and in that case its set to production mode. Every improvement you do on localhost you push to live. No need then to change modeon live
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book CodeIgniter4 on Apache(pages 92-114)
-
InsiteFX Super Moderator
     
-
Posts: 6,673
Threads: 338
Joined: Oct 2014
Reputation:
243
-
datamweb I'm interested in programming
  
-
Posts: 199
Threads: 13
Joined: Jun 2015
Reputation:
27
04-20-2022, 02:02 AM
(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!
-
5flex Junior Member
 
-
Posts: 30
Threads: 11
Joined: Sep 2019
Reputation:
2
(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!!!!!
|