nowox
nowox

Reputation: 29096

How to see the full stack trace in PHP?

I am running a script using Eloquent in standalone from the command line. I have an error somewhere in a SQL query, but the stack trace I get is incomplete:

PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S22]: 
    Column not found: 1054 Unknown column 'id' 
    in 'where clause' in ./vendor/illuminate/database/Connection.php:326
Stack trace:
#0 ./vendor/illuminate/database/Connection.php(326): 
    PDO->prepare('select * from `...')
#1 ./vendor/illuminate/database/Connection.php(657): 
    Illuminate\Database\Connection->Illuminate\Database\{closure}('select * from `...', Array)
#2 ./vendor/illuminate/database/Connection.php(624): 
    Illuminate\Database\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#3 ./vendor/illuminate/database/Connection.php(333): 
    Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#4 ./vendor/illuminate/database/Query/Builder.php(2062): 
    Illuminate\Database\Connection->select('select * from `...', Array, true)
#5 ./vendor/illuminate/database/Query/Builder.php(2050): 
    Illuminate\Database\Query\Builder->runSelect()
#6 /srv/nes in ./vendor/illuminate/database/Connection.php on line 664

How can I get the full stack-trace with no ... in my SQL queries?

Upvotes: 3

Views: 613

Answers (1)

KOUSIK MANDAL
KOUSIK MANDAL

Reputation: 2052

Please try to adding these;

$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

Upvotes: 3

Related Questions