Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ivanhalen's avatar

Laravel installation, getting "Parse error: syntax error, unexpected 'class' (T_CLASS)..." with PHP 5.6.11 or 5.5.27

Hello, I read around some similar topics about this error:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wamp\www\laravel5\artisan on line 31
Script php artisan clear-compiled handling the post-install-cmd event returned with an error

  [RuntimeException]
  Error Output:

run-script [--dev] [--no-dev] [-l|--list] [script] [args1] ... [argsN]

But in my case I have latest PHP stable version (5.6.11) and all the requirements are fulfilled (OpenSSL PHP Extension, PDO PHP Extension, Mbstring PHP Extension, Tokenizer PHP Extension - built-in)

Please, any help? Thank you

0 likes
3 replies
phildawson's avatar
Level 26

@ivanhalen

What does php -v give you on cli?

Forgetting Laravel for the moment, if you make a script and put the following in it

<?php

class Foo{}
echo Foo::class;

Do you get "Foo" output when ran from cli? php foo.php

2 likes
ivanhalen's avatar

Oh my, Phil, you just saved my day! I changed PHP version on WAMP, but the CLI version was the old 5.4.39: I updated it in my "Environment variables" setting, and it works now!

Thanks thanks thanks! I'll never forget to update environment variables anymore :-)

victoragung@gmail.com's avatar

I'm getting this and I've confirmed that the PHP version is 5.5.21 by doing both php -v and creating a phpinfo page. I'm using a subdomain on a Media Temple gridserver.

What else could it be?

Please or to participate in this conversation.