Support the ongoing development of Laravel.io →
Installation

Hi Guys. I was running my laravel project just fine in localhost, but now that I updated my files to my university's server. I'm getting the following error:

PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE)

First thing that came to my mind was PHP version, but:

Server version:

PHP 5.4.44-0+deb7u1 (cgi-fcgi) (built: Aug 16 2015 09:52:28) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Laravel 5.0 documentaion:

#Server Requirements

  • The Laravel framework has a few system requirements:
  • PHP >= 5.4
  • Mcrypt PHP Extension
  • OpenSSL PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension

No idea what can it be.

Last updated 2 years ago.
0

Are you sure you are running Laravel 5.0? Because 5.1 requires PHP >= 5.5.9. That error message sounds like it could be because of PHP 5.5's class name resolution.

Example: ObjectClassName::class

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class

0

thomastkim said:

Are you sure you are running Laravel 5.0? Because 5.1 requires PHP >= 5.5.9. That error message sounds like it could be because of PHP 5.5's class name resolution.

Example: ObjectClassName::class

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class

You right omg o.O I did follow the 5.0 documentation instalation guide. :O

$ php artisan --version
Laravel Framework version 5.1.17 (LTS)

Last updated 9 years ago.
0

Oddly enough, I think this is a good thing. It would be best to upgrade the PHP version to 5.5, especially since PHP stopped security support 21 days ago.

http://php.net/supported-versions.php

If you can't though, then you would be to downgrade to 5.0. I don't know of any easy way to do this. You can follow the "upgrade" guide and work backwards from there, but it would probably be easier just creating a fresh copy of Laravel and migrating the changes. I think this command installs a fresh Laravel 5.0:

composer create-project laravel/laravel {directory} "~5.0.0" --prefer-dist
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.