JMC
JMC

Reputation: 1697

Show Full Stack Trace on PHP Command Line

Problem

My PHP Stack Trace is abbreviated:

Stack trace:
#0 /www/html/table/app/create.php(128): SoapClient->__call('call', Array)
#1 /www/html/table/app/create.php(128): SoapClient->call('5e81ad4c12668ec...', 'table.ad...', Array)

Expected Outcome

I want to see the part that is hidden by the ... when running php from the command line. How do I make php show the full message?

Upvotes: 4

Views: 4014

Answers (2)

areynolds
areynolds

Reputation: 249

Had the same issue; apparently PHP by default limits the parameters in a stack trace to 15 bytes. In 8.0 PHP added a new .ini setting zend.exception_string_param_max_len to expand beyond that default. Add the following to your php.ini and you should get rid of the ellipses:

zend.exception_string_param_max_len=4096

Note that there is an option zend.exception_ignore_args=false that will hide all these args, so make sure that isn't enabled. See this article for full details.

Upvotes: 1

Matt Clark
Matt Clark

Reputation: 28589

You can surround it in a try ... catch and then do a var_dump on the exception.

try {

    // the code that throws an exception
} catch ( Exception $e ) {

   var_dump( $e->getTrace() );
}

Upvotes: 5

Related Questions