Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 - Php artisan syntax error

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

like image 639
gabahulk Avatar asked Aug 31 '15 13:08

gabahulk


People also ask

Why PHP artisan serve not working?

Reasons why php artisan serve not working You are running php artisan serve command in wrong directory. php artisan serve is laravel command only work with laravel project. Check project directory and run in root directory of your project. The requested host or port is not available.

What is PHP artisan in Laravel?

Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.

Can PHP artisan serve?

The Laravel PHP artisan serve command helps running applications on the PHP development server. As a developer, you can use Laravel artisan serve to develop and test various functions within the application. It also accepts two additional options. You can use the host for changing application's address and port.

How do I enable errors in Laravel?

Through your config/app. php , set 'debug' => env('APP_DEBUG', false), to true . Or in a better way, check out your . env file and make sure to set the debug element to true.


2 Answers

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.

like image 34
Bill Tanthowi Jauhari Avatar answered Oct 05 '22 00:10

Bill Tanthowi Jauhari


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!

like image 131
gabahulk Avatar answered Oct 04 '22 23:10

gabahulk