PHP command line – show errors

To show errors on php command line (cli) without changing php.ini

php -d error_reporting=E_ALL code1.php

Sample php code code1.php

echo $non_existing_var;

Sample output

php cli default case

$ php code1.php 
// No output if php.ini is not set for cli

php cli with error_reporting

$ php -d error_reporting=E_ALL code1.php 

Notice: Undefined variable: non_existing_var in /opt/tmp/code1.php on line 2
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments