# Error in new install of Slim

**URL:** <https://discourse.slimframework.com/t/error-in-new-install-of-slim/298>\
**Category:** Questions\
**Created:** [May 22, 2016, 5:16pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298 "2016-05-22T17:16:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![esson](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@esson](https://discourse.slimframework.com/u/esson)\
**Post date:** [May 22, 2016, 5:16pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/1 "2016-05-22T17:16:59Z")

</div>

Hi

Recently installed slim framework on my webserver. But when i run the exampe code i get a PHP error that I don’t really know how to fix.

```auto
[Sun May 22 19:11:45 2016] [error] [client 83.251.151.170] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/site/vendor/slim/slim/Slim/Container.php on line 151
```

followed the tutorial on [http://www.slimframework.com/docs/tutorial/first-app.html](http://www.slimframework.com/docs/tutorial/first-app.html)

The code that runs in index.php is:

```auto
<?php

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require '../vendor/autoload.php';

$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
    $name = $request->getAttribute('name');
    $response->getBody()->write("Hello, $name");

    return $response;
});
$app->run();
```

---

<div class="post-metadata">

**Author:** ![llvdl](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/llvdl/32/78_2.png) [@llvdl](https://discourse.slimframework.com/u/llvdl)\
**Post date:** [May 22, 2016, 6:49pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/2 "2016-05-22T18:49:12Z")

</div>

The specific line that the error message [points to](https://github.com/slimphp/Slim/blob/3.x/Slim/Container.php#L151) is:

```php
    return $trace['class'] === PimpleContainer::class && $trace['function'] === 'offsetGet';

```

Perhaps it is the `::class` constant that is not working for you. What version of PHP are you using? It should be PHP 5.5 or better.

---

<div class="post-metadata">

**Author:** ![esson](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@esson](https://discourse.slimframework.com/u/esson)\
**Post date:** [May 22, 2016, 8:02pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/3 "2016-05-22T20:02:05Z")

</div>

Hi

yest i figured there was a problem what failed on that row. Not the row itself.

I’m using  
PHP 5.6.21-9+donate.sury.org~precise+1 (cli)  
Copyright © 1997-2016 The PHP Group  
Zend Engine v2.6.0, Copyright © 1998-2016 Zend Technologies  
with Zend OPcache v7.0.6-dev, Copyright © 1999-2016, by Zend Technologies

On a ubuntu 12.04 LTS.  
Do you have any idea on how to solve this? I can’t re install the server or build a new one since there are some other sites running same server.

Thanks

---

<div class="post-metadata">

**Author:** ![llvdl](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/llvdl/32/78_2.png) [@llvdl](https://discourse.slimframework.com/u/llvdl)\
**Post date:** [May 22, 2016, 8:28pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/4 "2016-05-22T20:28:27Z")

</div>

The version is fine. Do you get the same version number when you put

```php
<?php phpinfo();

```

on a page and open the page in your browser?

---

<div class="post-metadata">

**Author:** ![esson](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@esson](https://discourse.slimframework.com/u/esson)\
**Post date:** [May 22, 2016, 8:37pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/5 "2016-05-22T20:37:56Z")

</div>

Hi  
Yes i do.

`PHP Version 5.4.45-3+donate.sury.org~precise+3`

also did a clean re-install and got the same problem for the 10th time to 🙂

---

<div class="post-metadata">

**Author:** ![esson](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@esson](https://discourse.slimframework.com/u/esson)\
**Post date:** [May 22, 2016, 8:38pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/6 "2016-05-22T20:38:58Z")

</div>

Could this be the problem?

`Server API	Apache 2.0 Handler`

---

<div class="post-metadata">

**Author:** ![JoeBengalen](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@JoeBengalen](https://discourse.slimframework.com/u/JoeBengalen)\
**Post date:** [May 22, 2016, 8:45pm UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/7 "2016-05-22T20:45:18Z")

</div>

Your second php version is 5.4, which is not supported

---

<div class="post-metadata">

**Author:** ![esson](https://avatars.discourse-cdn.com/v4/letter/e/f0a364/32.png) [@esson](https://discourse.slimframework.com/u/esson)\
**Post date:** [May 23, 2016, 6:34am UTC](https://discourse.slimframework.com/t/error-in-new-install-of-slim/298/8 "2016-05-23T06:34:18Z")

</div>

I see, need to figure out how to get apache2 to use the later PHP version. Thanks!
