Back

Laravel 5 Error on Installation.


xxyxxyz posted 2 years ago

I'm trying to create a new Laravel project via "laravel new project_name" however it stays on crafting the application for a minute or two and then it shows this error:

Crafting application...

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T
_STRING) or variable (T_VARIABLE) or '{' or '$' in I:\PP\artisan on line 31
Script php artisan clear-compiled handling the post-install-cmd event returned w
ith an error

[RuntimeException]
Error Output:

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

Application ready! Build something amazing.

Furthermore, when I go to check the installation in my web browser I'm thrown this error:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in I:\PP\public\index.php on line 50

Is anyone else facing this error? I've updated my Composer installation as well as the installer for Laravel.

harikt replied 2 years ago

What version of PHP are you using ?

xxyxxyz replied 2 years ago

harikt said:

What version of PHP are you using ?

PHP version is 5.4.16.

kayyyy replied 2 years ago Solution

xxyxxyz said:

harikt said:

What version of PHP are you using ?

PHP version is 5.4.16.

Installation

Server Requirements

The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine:

PHP >= 5.5.9 OpenSSL PHP Extension Mbstring PHP Extension Tokenizer PHP Extension

xxyxxyz replied 2 years ago

chris said:

xxyxxyz said:

harikt said:

What version of PHP are you using ?

PHP version is 5.4.16.

Installation

Server Requirements

The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine:

PHP >= 5.5.9 OpenSSL PHP Extension Mbstring PHP Extension Tokenizer PHP Extension

I see. Thanks, was this changed recently as I had no problems beforehand when making a new Laravel project.

tkprocat replied 2 years ago

Yep, it was changed 12 days ago, see https://github.com/laravel/framework/commit/8349040e7381d083868fa40bd7dcaf301f0347e3

dhavalv replied 1 year ago

It's same problem on PHP V5.6.15

PHP Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /opt/lampp/htdocs/laravel_demo/artisan on line 31

ggwebdev replied 1 year ago

I have same problem, check your php version run on shell. In my case the phpinfo shows me 7.0.7 and in my shell runs 5.3.10.... Update php version and i belive it works.

bigwelly replied 9 months ago

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/mydomain/public/index.php on line 50

-> PHP 5.6.29 (cli) (built: Dec 14 2016 14:03:32) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v6.0.5, Copyright (c) 2002-2016, by ionCube Ltd. with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies

-> Composer version 1.3.1 2017-01-07 18:08:51

-> Laravel Framework version 5.2.45

sergepiskarev replied 5 months ago

bigwelly said: Have the same problem with quite the same config :-(

Resnef Immatong replied 1 week ago

Hi.I have the same problem. My local copy runs good but the copy uploaded into the server shows this error just a few months after it has been running good. We contacted the server administrator and they said they have made clearing actions last week and I don't have any idea what have they done even my employer. Is it the sever who made this to happen (did they upgrade their PHP version because the system runs well previously) or is the system affected after their clearing? Please help me. I have no idea how and what to say to my employer. What will I ask to the system administrator about this problem.


Sign in to participate in this thread!



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