Search code examples
laravellaravel-artisanartisan-migrate

laravel : php artisan suddenly stop working


I know that there bunch of questions out there but mine doesn't seems fit in any.

I am working on laravel. php artisan was working fine an hour before. After that i just created a controller, a model and few views blade.

Now artisan simply won't work and no error at all. Even php artisan --version won't show anything.

I DIDN'T do any major changes like composer install, or update or install any new package. Neither any server configuration. It was just basic coding on controller , model and views.

Not sure what is causing this. What could be the reason and how shall i start debugging it?


Solution

  • Artisan is an integrated part of Laravel, meaning it's using a console Application instance to run a command, and it will stop execution for errors which may come from any part of your application.

    Syntax errors can be a common culprit that will stop artisan from working, and if debugging is not enabled errors are not displayed (just logged) so you get no output when running a command.

    To search for syntax errors, go to your project directory and try linting the entire directory by running this command:

    find -L ./ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l | grep "Errors parsing".
    

    If any syntax errors are present, the command will output the first file that has an error, the line where it occurs and the error message.