dream6120 2014-11-19 18:59
浏览 89

Wamp x64上的MongoDB(win x64)= mongo.native_long错误

I've a big problem with my development environment.

Context :
My computer : Win 8.1 x64
My WampServer install : x64
My MongoDB install : x64 from http://www.mongodb.org/downloads

I've installed the php extension from http://pecl.php.net/package/mongo.

My problem is that our production server store some 64 bits INT into the database.

When I try, in my development environment, to access to this data, I've got:

MongoCursorException

Cannot natively represent the long 1108547148863410176 on this platform

I found on internet that a parameter of mongoDB called "mongo.native_long = 1" is needed to use 64 bits INT on 64 bits architecture.
But when I try to add this param in my "php.ini" file, the server don't start and give me an error like :

[19-Nov-2014 18:25:52 UTC] PHP Fatal error: PHP Startup: To prevent data corruption, you are not allowed to turn on the mongo.native_long setting on 32-bit platforms in Unknown on line 0

Does my mongoDB extension DLL is build on 32 Bit or I missed something to do ?

  • 写回答

4条回答 默认 最新

  • douqian4411 2014-12-30 21:30
    关注

    For me the only thing that worked was:

    ini_set('mongo.long_as_object', 1);
    

    Hope it saves someone's time. It's one of those stupid things that make you wonder: "Why the hell did I become a programmer?"

    EDIT: getting proper driver from http://pecl.php.net/package/mongo helped me. I've downloaded latest driver. Check your version using phpinfo() command. E.g. for me, on 64-bit Win7 it's:

    PHP Version 5.5.12
    PHP Extension Build:    API20121212,TS,VC11
    

    Notice the "TS,VC11" string. It means it's Thread Safe, but your version may not be thread safe (NTS).

    So I downloaded 64bit, TS for PHP 5.5. I was dealing with this problem long time and finally, proper driver solved this issue.

    评论

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀