# How to solve this error in php slim3

**URL:** <https://discourse.slimframework.com/t/how-to-solve-this-error-in-php-slim3/5834>\
**Category:** Questions\
**Created:** [March 6, 2024, 2:55am UTC](https://discourse.slimframework.com/t/how-to-solve-this-error-in-php-slim3/5834 "2024-03-06T02:55:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Syeda](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Syeda](https://discourse.slimframework.com/u/Syeda)\
**Post date:** [March 6, 2024, 2:55am UTC](https://discourse.slimframework.com/t/how-to-solve-this-error-in-php-slim3/5834/1 "2024-03-06T02:55:04Z")

</div>

```auto
$c = new \Slim\Container();
$c['errorHandler'] = function ($c) {
    return function ($request, $response, $exception) use ($c) {
        return $response->withStatus(500)
            ->withHeader('Content-Type', 'text/html')
            ->write('Something went wrong!');
    };
};
$app = new \Slim\App($c);

```

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [March 7, 2024, 4:22pm UTC](https://discourse.slimframework.com/t/how-to-solve-this-error-in-php-slim3/5834/2 "2024-03-07T16:22:38Z")

</div>

```php
$response = $response->withStatus(500)
    ->withHeader('Content-Type', 'text/html');

$response->getBody()->write('Something went wrong!');

return $response;

```
