手揣网教程/系统工具/内容

ElastaticSearch的版本兼容问题以及处理方案

系统工具2024-11-01 阅读
[摘要]环境:Ubuntu:Linux iZ620vnh79jZ 3.13.0-86-generic #130-Ubuntu SMP Mon Apr 18 18:27:15 UTC 2016 x86_64 ...
环境:
Ubuntu:
Linux iZ620vnh79jZ 3.13.0-86-generic #130-Ubuntu SMP Mon Apr 18 18:27:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
 
PHP版本:
PHP 5.5.9-1ubuntu4.21 (cli) (built: Feb9 2017 20:54:58)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo
with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo
 
Mysql版本:
mysqlVer 14.14 Distrib 5.5.52, for debian-linux-gnu (x86_64) using readline 6.3
 
在搭建ElastaticSearch以后,访问需求端口会出现:
Your version of PHP / json-ext does not support the constant 'JSON_PRESERVE_ZERO_FRACTION',".
" which is important for proper type mapping in Elasticsearch. Please upgrade your PHP or json-ext.\n".
"If you are unable to upgrade, and are willing to accept the consequences, you may use the allowBadJSONSerialization()".
" method on the ClientBuilder to bypass this limitation.
 
这是Elastic的库中出现的问题,对于JSON_PRESERVE_ZERO_FRACTION,该常量是在PHP5.6版本之后才引出来的。所以,此处要写兼容的,解决方案如下:
if(!defined('JSON_PRESERVE_ZERO_FRACTION'))
{
define('JSON_PRESERVE_ZERO_FRACTION', 1024);
}
问题解决!

Linux是一套免费使用和自由传播的类Unix操作系统

……

相关阅读