I've been playing with HHVM config file and I have yet to be able to make it output any fatal error to the browser. It displays E_NOTICE and E_WARNING but when any E_ERROR happens it leaves the page blank and the error only appears in the HHVM log file.
Is there a way to make it show in the browser?
My HHVM config file is as follow:
PidFile = /var/run/hhvm/pid
Log {
Level = Warning
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
UseLogFile = true
UseSyslog = false
File = /var/log/hhvm/error.log
InjectedStackTrace = false
NativeStackTrace = false
Access {
* {
File = /var/log/hhvm/access.log
Format = %h %l %u % t \"%r\" %>s %b
}
}
}
ErrorHandling {
CallUserHandlerOnFatals = true
NoInfiniteLoopDetection = false
NoInfiniteRecursionDetection = false
ThrowBadTypeExceptions = false
ThrowNotices = false
NoticeFrequency = 1 # 1 out of these many notices to log
WarningFrequency = 1 # 1 out of these many warnings to log
AssertActive = false
AssertWarning = false
}
Debug {
FullBacktrace = false
ServerStackTrace = false
ServerErrorMessage = false
TranslateSource = false
RecordInput = false
ClearInputOnSuccess = true
ProfilerOutputDir = /tmp
CoreDumpReport = true
CoreDumpReportDirectory = /tmp
}
Http {
DefaultTimeout = 30 # in seconds
SlowQueryThreshold = 5000 # in ms, log slow HTTP requests as errors
}
Mail {
SendmailPath = sendmail -t -i
ForceExtraParameters =
}
Preg {
BacktraceLimit = 100000
RecursionLimit = 100000
}
Repo {
Central {
Path = /var/log/hhvm/.hhvm.hhbc
}
}
Eval {
Jit = true
}
MySQL {
TypedResults = false
ReadOnly = false
ConnectTimeout = 2000 # in ms
ReadTimeout = 2000 # in ms
SlowQueryThreshold = 2000 # in ms, log slow queries as errors
KillOnTimeout = false
}
Nginx:
location ~ \.php$ {
fastcgi_keep_conn on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 900;
fastcgi_send_timeout 900;
fastcgi_intercept_errors off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
You need to enable the configuration hhvm.server.implicit_flush
in your php.ini
, then you can send a response body in case of fatal errors. To be able to catch fatal errors with an error handler, you should also enable hhvm.error_handling.call_user_handler_on_fatals
.
For details, refer to the github issue on hhvm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With