JSON

ElastaticSearch的版本兼容问题以及解决方案

字号+ 作者:H5之家 来源:H5之家 2017-10-03 17:02 我要评论( )

环境: 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-1

环境:

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);

}

问题解决!

 

本文永久更新地址:

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
网友点评