Welcome Guest, Not a member yet? Register   Sign In
Codeigniter 4 Debugging
#1

I used to use CI3 then moved over to Laravel. I am keen to start my new game project using CI4, but am battling to get around some of issues.

The main issue that I am having is the debugging mode in development.

Code:
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------

# CI_ENVIRONMENT = development

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

# app.baseURL = 'http://localhost/simplife/'
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
# app.CSPEnabled = false

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

# database.default.hostname = localhost
# database.default.database = ci4
# database.default.username = root
# database.default.password = root
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306

# database.tests.hostname = localhost
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306

I have set the CI_ENVIRONMENT = development and I have set the base URL.

When there is an issue on the page, I get no details of the issue, simply a message stating Whoops.

I have tried the app on Laragon, Xampp and now on Wampserver. I get no details of errors at all. Please help
Reply
#2

(This post was last modified: 05-28-2023, 10:02 AM by captain-sensible. Edit Reason: as jimmy cricket may have once said "wait there's mooore" )

check its not the usual suspects. if on Linux make sure
Code:
sudo chmod  777 witable _R
make sure in app/config/App.php base uel is set to something your are using . mine is :
Code:
public $baseURL = 'http://127.0.0.7/';

baecuase it set each dev to a url via /etc/hosts then also virtual host config

in app/config/Logger.php

Code:
public $threshold = 9;

you can have a play around in controllers with a try catch block. For blogs I have a log in, by admin and session. Then i have a code block, to help inform me of errors


Code:
try

{
//something
}

catch ( \Exception  $e)
             {
                         
             $data = [
                        'title'  => 'info',
                      
                   'info'=>'something  went wrong with new blog' ,
                   'infoException'=>$e->getMessage(),
                   'date'=>$this->myDate,
                     ];
            
                echo view('info2', $data);
                 die();
             //above try catch works  and outputs rendered issue to view
                }

So i have a view called info2.php used specifically for errors (for dev) if exception is caught i find it nice to output to a view . IN the view I have

Code:
    <h11><?php echo $infoException;?></h11>


at least its better than a blank page lol
CMS CI4     I use Arch Linux by the way 

Reply
#3

If that is your actual .env file then you need to uncomment the  CI_ENVIRONMENT and app.baseURL lines



PHP Code:
CI_ENVIRONMENT development

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

 app.baseURL 'http://localhost/simplife/' 


Reply
#4

or
Code:
$_SERVER['CI_ENVIRONMENT'] = 'development';

in your /public/index.php
CMS CI4     I use Arch Linux by the way 

Reply
#5

(05-28-2023, 05:27 AM)Mark Morcom Wrote: I used to use CI3 then moved over to Laravel. I am keen to start my new game project using CI4, but am battling to get around some of issues.

The main issue that I am having is the debugging mode in development.

Code:
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------

# CI_ENVIRONMENT = development

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

# app.baseURL = 'http://localhost/simplife/'
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
# app.CSPEnabled = false

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

# database.default.hostname = localhost
# database.default.database = ci4
# database.default.username = root
# database.default.password = root
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306

# database.tests.hostname = localhost
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306

I have set the CI_ENVIRONMENT = development and I have set the base URL.

When there is an issue on the page, I get no details of the issue, simply a message stating Whoops.

I have tried the app on Laragon, Xampp and now on Wampserver. I get no details of errors at all. Please help
You need to uncomment  (remove the # before) the CI_ENVIRONMENT and app.baseURL lines to get it to work.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB