Debugging a Laravel 5 artisan migrate unexpected T_VARIABLE FatalErrorException
Asked Answered
G

2

5

When running artisan migrate on a Laravel 5 project, it is failing with the following FatalErrorException:

$ artisan migrate -vvv --force

[Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected '$table' (T_VARIABLE)

How do I get the file and line that is causing the error?

If in anyway relevant, I'm on a Windows 7 x64 machine with WAMP - PHP 5.6 and Laravel Framework version 5.1.10 (LTS).

Gabion answered 13/8, 2015 at 9:6 Comment(3)
Having the same problem. I have triple checked my migration files. They run on local machine but error on remote :(Simonne
@Simonne try running php lint recursively to have it check for any syntax errors, you could use gist.github.com/mathiasverraes/3096500 (if on windows, you can run it with mingw.org or git-bash)Gabion
find . -type f -name '*.php' -exec php -l {} \; |grep -v "No syntax errors detected" is a one-liner you could use for the same - credit: gist.github.com/k3n/1846220#gistcomment-2148283Gabion
S
13

There might be a semicolon or bracket missing a line

Check all in your migration files.

Laravel is configured to create daily log files for your application which are stored in the storage/logs directory.

http://laravel.com/docs/5.1/errors#logging

Swum answered 13/8, 2015 at 9:26 Comment(2)
I did go through them manually, and I couldn't find the error, so I was wondering if there is a log file somewhere or a command-parameter that'll give me the full-stack-trace or the file and line where this error stems from.Gabion
Thank you so much! I wish it would show you the error reported in the log file when you use artisan for migrations.Dihydrostreptomycin
C
0

This class Symfony\Component\Debug\Exception\FatalErrorException has some differences compared with the other Exception classes and it is not properly presented by the "error renderers" or "error notifiers".

A New sentry "error notifier" ("getsentry/sentry-php" version >= "2.0") will give you a proper stack trace.

Cough answered 25/10, 2019 at 8:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.