Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whoops! We seem to have hit a snag. Please try again later

Whoops! We seem to have hit a snag. Please try again later.

Codeigniter 4 shows an error when I run the CI4 application, How I resolve?

Changes:

public $baseURL = 'http://ci.local';


public $baseURL = 'http://localhost:8080';
public $indexPage = '';
like image 475
Nasir Uddeen Avatar asked Sep 09 '19 10:09

Nasir Uddeen


4 Answers

Assume that your root folder of your CI4 project is rootproject. Edit rootproject/.env file. On line 17 change from:

#  CI_ENVIRONMENT = production

to:

CI_ENVIRONMENT = development

Save it.

Refresh your browser that pointing to your CI4 project. It should give you many error messages.

If there is something written as CacheException, than your cache folders are not writable. Make it writable;

Ubuntu:

chown -Rv www-data rootproject/writable

CentOS:

chown -Rv apache rootproject/writable

Easy way:

chmod 777 -Rv rootproject/writable
like image 24
rexluther Avatar answered Oct 19 '22 05:10

rexluther


This work for me try it Go to app directory then to boot directory you will see production.php file.

That is: app => Config => Boot => production.php

Change the ini_set('display_errors', '0') to ini_set('display_errors', '1').

Warning: When in production change back to initial ini_set('display_errors', '0')

Or

you can rename your file env in your project directory to .env after that open it and edit. Search for # CI_ENVIRONMENT = production remove # and change production to development

Warning: When in production change back to initial CI_ENVIRONMENT = development to CI_ENVIRONMENT = production

For those experiencing intl error go to where your php installation directory edit the php.ini file remove semi-colon ";" from ;extension=intl to extension=intl. save the file and restart your server. I think this will solve that error. This particular editing of my php.ini was on php 7.2 - 8.1 so I haven't check other version of php lesser than these versions which Codeigniter 4 does not support

like image 67
4 revs Avatar answered Oct 19 '22 06:10

4 revs


After installing CodeIgniter 4 when you run the app then you will get an error like this

enter image description here

To know the error go to the app/Config/Boot/production.php and set display_errors to 1 as below

ini_set('display_errors', '1');

Now, you will see the actual error below

enter image description here

Nothing to worry about it. The app needs permission. Assign the permission like as below

sudo chmod -R 777 project_name

like image 15
Umang Soni Avatar answered Oct 19 '22 04:10

Umang Soni


In your CI4 project root, create a file named .env. It should be in the same directory as system, app e.t.c

Then, add this CI_ENVIRONMENT = development

like image 6
mLawrenci Avatar answered Oct 19 '22 05:10

mLawrenci