Laravel 5 - Php artisan syntax error

前端 未结 7 1645
清歌不尽
清歌不尽 2021-02-07 07:41

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:



        
相关标签:
7条回答
  • 2021-02-07 07:43

    Try running with the verbose argument, like so:

    php artisan ... --verbose
    
    0 讨论(0)
  • 2021-02-07 07:47

    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!

    0 讨论(0)
  • 2021-02-07 07:53

    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.

    0 讨论(0)
  • 2021-02-07 07:55

    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.

    0 讨论(0)
  • 2021-02-07 08:02

    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.

    0 讨论(0)
  • 2021-02-07 08:04

    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

    0 讨论(0)
提交回复
热议问题