当HHVM出现故障时,我想回到nginx上的下一个上游(php5-fpm)。目前这不可能,因为HHVM在致命错误后输出200 OK
响应代码。至少我想提供更多信息丰富的状态代码。
PHP错误日志:
\nFatal error: $this is null in /data/wordpress/htdocs/wp-content/plugins/woocommerce-gateway-klarna/classes/class-klarna-account.php on line 1231
我确信它可以在php5-fpm中运行。
HHVM版本:
hhvm --version
HipHop VM 3.4.0 (rel)
Compiler: tags/HHVM-3.4.0-0-g817b3a07fc4e509ce15635dbc87778e5b3496663
Repo schema: 0e12aaa31fae66b5591f65603de50c9d62caafac
Extension API: 20140829
答案 0 :(得分:4)
我通过为hhvm注入自定义错误处理程序来修复此问题。
我的index.php
用于wordpress:
<?php
/**
* HHVM outputs http status: 200 OK even on fatal errors.
* Catch fatal errors on HHVM and put right response code.
*/
//Is this HHVM?
if (defined('HHVM_VERSION')) {
set_error_handler('catch_fatal_error_hhvm',E_ERROR);
}
function catch_fatal_error_hhvm() {
http_response_code(500);
die();
}
// WordPress view bootstrapper
define('WP_USE_THEMES', true);
require(dirname( __FILE__ ) . '/wordpress/wp-blog-header.php');