I am trying to debug a WolfiOS docker image with an Laravel app.
php artisan
does not print out anything (normally it would display the usage help)
/var/www/html # php -d "display_errors=On" -d "display_startup_errors=On" artisan
/var/www/html #
In my INI, display_errors is currently off, that is why I am activating it via -d
and it the setting’s a picked up:
/var/www/html # php -d "display_errors=On" -d "display_startup_errors=On" -i |grep error
display_errors => STDOUT => STDOUT
display_startup_errors => On => On
error_append_string => no value => no value
error_log => /var/log/php_error.log => /var/log/php_error.log
error_prepend_string => no value => no value
error_reporting => E_ALL => E_ALL
html_errors => Off => Off
ignore_repeated_errors => Off => Off
log_errors => On => On
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
intl.error_level => 0 => 0
So even when I tried enabling error reporting, nothing is printed.
What can be the cause?
I would expect an error to be printed, if something went wrong.
EDIT:
Last useful thing I see, when prepending strace
is something about a ContainerException
:
openat(AT_FDCWD, "/var/www/html/vendor/psr/container/src/ContainerExceptionInterface.php", O_RDONLY) = 4
I am more interested in why no error is printed, than what could be the cause, from there I will figure it out.
EDIT2:
I now also changed in the ini:
expose_php = Off
error_reporting = ${PHP_ERROR_REPORTING}
display_errors = On
display_startup_errors = On
and verified:
/var/www/html # php -i |grep error
display_errors => STDOUT => STDOUT
display_startup_errors => On => On
error_append_string => no value => no value
error_log => /var/log/php_error.log => /var/log/php_error.log
error_prepend_string => no value => no value
error_reporting => E_ALL => E_ALL
html_errors => Off => Off
ignore_repeated_errors => Off => Off
log_errors => On => On
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
intl.error_level => 0 => 0
I created a smaller example with an error – no output still:
/var/www/html # cat error.php
<?php
echo "teststring
/var/www/html # php error.php
/var/www/html #
EDIT3:
I was asked, if STDOUT is even working correctly – it is:
/var/www/html # cat noerror.php
<?php
echo "no error" . PHP_EOL;
/var/www/html # php noerror.php
no error
2
Answers
When I remove the error reporting settings an
error_log
/log_errors
from thephp.ini
I get an error output on the console.For some reason, passing these variables on the CLI does not help:
I switched the ini setting to
So I get errors on the CLI as well as the docker log stream, when something goes wrong.
No I can continue with debugging the error's cause.
Artisan accepts a -vvv flag to be more verbose during execution. Perhaps try this?