Have a custom error page that shows a message when a user is logged in vs not logged in and trying to access a page that does not exist or that they don’t have rights too.
Redirect all "fatal" errors to a custom location (db table / my log file / etc… ) so that it does not show up to the front end user. Instead they should see a standard error page with little to know info that I can control.
I believe I have goal 1 working to a degree of where I want. I can get the custom error page to show up for goal 1 and have it show different info based on if they are logged in or not. Goal 2 is the one giving me a problem. I can not get/understand how to stop the fatal error / stack trace from showing up on the front page.
But I still get the fatal errors showing to the front end user. Also, I am not sure how I can override that default page so that it will show our custom message and then record that information to a place we would like to store it.
Any help would be appreciated and if you need more info from me please let me know.
// comment out the following two lines when deployed to production
// defined('YII_DEBUG') or define('YII_DEBUG', true);
// defined('YII_ENV') or define('YII_ENV', 'dev');
require(__DIR__ . '/../vendor/autoload.php');
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
$config = require(__DIR__ . '/../config/web.php');
(new yii\web\Application($config))->run();
Thank you. That was it. I even did a grep in my /app/* looking for YII_ENV / YII_DEBUG and I didn’t find it. I must have fat fingered it or something.
Also the key here is that the documentation was saying to modify an entry script which I don’t think the config/web.php file is. I didn’t catch that until this all started working.