-1

is it possible to have a customised Maximum execution time so instead of showing

PHP Fatal Error – yii\base\ErrorException

Maximum execution time of 30 seconds exceeded

and then showing all the code on the error page, I'd like it to take you to a customised error page saying something like "you need to add some search criteria to reduce the number of records being returned"

or some such thing. I am working with Yii2 and PHP

I have the following action in my site controller

public function actions()
{
    return [
        'error' => [
            'class' => 'yii\web\ErrorAction',
        ],
        'captcha' => [
            'class' => 'yii\captcha\CaptchaAction',
            'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
        ],
    ];
}

and I have a page called views/site/error.php

<div class="alert alert-danger" style="font-size: 14pt; text-align: center;">
    <?= nl2br(Html::encode($message)) ?>
</div>

<p>
    Please contact Client Support team if you think this is an error with our servers.
</p>

<?= Html::a('Back', Yii::$app->request->referrer, ['class' => 'btn btn-info']) ?>
<?= Html::a('Home', ['/'], ['class' => 'btn btn-success']) ?>

but if never goes to this page with an execution time error

Not sure what I did, but it does go to the custom error page now but it still shows the code below my custom message

enter image description here

so is there a way of getting rid of the information below my custom message. There is nothing else on my error.php than what is in the code above

Helen Postle
  • 45
  • 1
  • 10

1 Answers1

0

after further investigation, I've found that it was going to a different page execption.php not error.php which was showing the full error below the text. So I've managed to sort it now :)

Helen Postle
  • 45
  • 1
  • 10