CodeIgniter 4 CI_ENVIRONMENT set to development gives "No direct script access allowed" error

1.2k views Asked by At

I am trying to change the environment of my CI4 project to development. I changed the value in the .env file and removed the "#",but when I do so I am greeted with a "No direct script access allowed" error.

I tried changing it to testing as well but then I get the following message:

Fatal error: Uncaught Error: Class 'Tests\Support\Log\TestLogger' not found

The CI4 version we are currently using is one of the earlier versions that was released but we did update the files to a more recent version a while ago.

Could this error be caused by an incomplete older version of CodeIgniter? There are quite a lot of thing we changed to make it work initially so if we need to move it to a newer version it might take some time and move us further behind schedule. But if this is the only thing that will work then we will need to do so.

I renamed the 'Errors' view file to see if I can skip the "No direct script access allowed" message, but then I get an error message because it cannot find the view.

Is it safe to remove the following line from the error views?

defined('BASEPATH') OR exit('No direct script access allowed');

Thank you for any help you can provide

1

There are 1 answers

0
CopperRabbit On BEST ANSWER

The issue has been resolved by changing the project to CodeIgniter 4.0.4. We still have to update a lot of the php from how this version differs from the alpha version, but I do believe all the issues have been resolved.