'CodeIgniter 4 - No direct script access allowed

After installing and configuring CI 4 I can see the home controller and the debug bar as normal (I'm in development mode).

There is a problem with error reporting. If I try to deliberately write some wrong PHP code, CodeIgniter overrides the normal PHP behaviour and hides the errors (in development mode!!).

Here's an example of deliberately adding a PHP error to the home controller:

<?php namespace App\Controllers;

class Home extends BaseController
{
    public function index()
    {
        this is an error!! ()
        return view('welcome_message');
    }

}

Here's the output (which is not helpful with real errors):

No direct script access allowed

How can I set CodeIgniter 4 to show PHP errors? (the error is not even logged anywhere inside the server)



Solution 1:[1]

this problem happened when u delete this folder (app/view/errors) from view

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1