Hhvm-fastcgi没有显示警告



我使用的是Nginx的HHVM 3.1.0 (rel), fastcgi没有显示警告,而是在控制台上运行HHVM。这正常吗?

我的php . ini中:

error_reporting = E_ALL
display_errors = 1
hhvm.error_handling.call_user_handler_on_fatals = false
hhvm.error_handling.max_loop_count = 0
hhvm.error_handling.no_infinite_recursion_detection = false
hhvm.error_handling.throw_bad_type_exceptions = true
hhvm.error_handling.throw_too_many_arguments = true
hhvm.error_handling.warn_too_many_arguments = true
hhvm.error_handling.throw_missing_arguments = true
hhvm.error_handling.throw_invalid_arguments = true
hhvm.error_handling.enable_hip_hop_errors = true
hhvm.error_handling.notice_frequency = 1
hhvm.error_handling.warning_frequency = 1
hhvm.debug.full_backtrace = true
hhvm.debug.server_stack_trace = true
hhvm.debug.server_error_message = true
hhvm.debug.translate_source = true

我也遇到过同样的问题,堆栈问题

经过一番挖掘,我发现了问题所在。没有为HHVM设置error_handler。所以你需要自己设置。

我写了一个简单的,看起来像PHP的一个,虽然不完整,但错误级别

set_error_handler(function ($errorNumber, $message, $errfile, $errline) {
    switch ($errorNumber) {
        case E_ERROR :
            $errorLevel = 'Error';
            break;
        case E_WARNING :
            $errorLevel = 'Warning';
            break;
        case E_NOTICE :
            $errorLevel = 'Notice';
            break;
        default :
            $errorLevel = 'Undefined';
    }
    echo '<br/><b>' . $errorLevel . '</b>: ' . $message . ' in <b>'.$errfile . '</b> on line <b>' . $errline . '</b><br/>';
});

最新更新