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


    环境:

    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: Feb  9 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版本:

    mysql  Ver 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.
    ".
                "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);
    }
    

      问题解决!

  • 相关阅读:
    hdu3746Cyclic Nacklace(KMP)
    hdu2087剪花布条(KMP)
    cellspacing cellpadding
    3行3列表格 table实现,div+css实现
    自动办公系统
    (转载)互联网协议入门(二)
    (转载)互联网协议入门(一)
    去掉考勤
    第二次装OA系统
    Windows 7系统下局域网文件共享设置方法
  • 原文地址:https://www.cnblogs.com/bing-yu12/p/7577581.html
Copyright © 2020-2023  润新知