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

astm's avatar
Level 1

laravel 5 installation php artisan parse error expecting identifier (T_STRING)

Guys why every time when I installing Laravel 5 after typing the command " laravel new project-name " usually I got the issue

Parse error: parse error, expecting "identifier (T_STRING)"' or"variable (T_VARIABLE)"' or '{'' or'$'' in /Applications/MAMP/htdocs/test/artisan on line 31 Script php artisan clear-compiled handling the post-install-cmd event returned with an error

[RuntimeException]
Error Output:

Also when i'm trying to the command " php -S localhost:8888 -t public " to open the sever and open it in the browser I always see this issue on my home page

Parse error: parse error, expecting "identifier (T_STRING)"' or"variable (T_VARIABLE)"' or '{'' or'$'' in /Applications/MAMP/htdocs/test/public/index.php on line 50 how I can fixed it !!!

0 likes
8 replies
mstnorris's avatar

Try installing the Laravel Installer again. That may be broken.

astm's avatar
Level 1

HI , I'm changed my internet connection and tried a lot of time but every time I get the same issue !!! I think It's not from the installer , there's something else missing :(

mstnorris's avatar

@atsm have you tried install Homestead and also creating a project using the composer command?

astm's avatar
Level 1

No , I didn't installed the homestead , I think I don't need it I installed laravel before without homestead and it was working well I'm working on Mac not window

astm's avatar
Level 1

my steps to install laravel on my mac commands was

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
export PATH="~/.composer/vendor/bin:$PATH" 
composer global require "laravel/installer=~1.1”

then creating the new project by typing the command

 laravel new my-project-name

OR

composer create-project laravel/laravel my-project-name

Then open the server by the command

php -S localhost:8888 -t public
astm's avatar
Level 1

Hello Saswanb , I updated my PHP version to PHP 5.6.9

now the command

php -v 

gaves me

PHP 5.6.9 (cli) (built: May 15 2015 12:59:46) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans

but after create new laravel project I still get the same issue !!! :(

Boka's avatar

Had the same... There was an error on my route.php file... Don't know why but having a problem there involves artisan parsing procedure...

Please or to participate in this conversation.