Reputation: 611
I am currently developing an app with Laravel 5 and suddenly the artisan stoped working!
I can't use a single command on it, it always return the error:
[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected ',', expecting variable (T_VARIABLE)
I tried to update via composer but when the artisan tries to clear-complie
Command: composer update
> php artisan clear-compiled
[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected ',', expecting variable (T_VARIABLE)
Has anyone ever had this error before?
My Php version is 5.6.8
Upvotes: 18
Views: 63457
Reputation: 13
I have received the same error in routes.php. I have given the wrong Route.
I put Route::get('/admin' , AdminController@index);
instead of Route::get('/admin' , 'AdminController@index');
I forgot single quotes. Please check yours.
Upvotes: -1
Reputation: 2684
Instead of executing the commands using command prompt. It will be easy to look at LOG file found at location/directory
storage/logs/laravel.log
I am sure, you can easily check the log file and fix the syntax error.
Upvotes: 3
Reputation: 340
None of these solutions will always work.
php artisan tinker --verbose will often not give you the stack trace which will show the source of the error.
running in the browser will also not always give the error.
The solution is simple : look in storage/logs/laravel.log there the full stack trace will show
For ease of finding (if file is huge), open the file, delete all contents, run tinker and when come back only the specific error info will be there.
Hope this helps someone else
Upvotes: 0
Reputation: 8156
Try running with the verbose argument, like so:
php artisan ... --verbose
Upvotes: 1
Reputation: 167
I recently ran into this same error, although the error was probably a different cause from yours. Turns out we had recently updated to PHP 7 and I hadn't upgraded yet. The issue was caused by a return type being set on a function, which wasn't supported in my local version of php. Ran an update on Homestead, which upgraded my PHP version and fixed the issue.
Upvotes: 1
Reputation: 193
Try this command:
php -S localhost:8000 -t public
Then execute it on browser, it will produce the error, just look at the error, and fix it.
Upvotes: 11
Reputation: 611
I've found the error!
I had a syntax error on my routes.php file...
function($id,**name**,**value**)
Forgot the $ sign and thus it found a unexpected ','.
Thank you all for the help!
Upvotes: 25