dousuie2222 2018-01-24 11:50
浏览 53

如何在PHP中安装Mongodb驱动程序

I followed the steps mentioned here https://www.youtube.com/watch?v=9gEPiIoAHo8.

I downloaded the latest stable version of it here https://pecl.php.net/package/mongodb which is 1.3.4. Extracted the php_mongodb.dll and placed it in the ext in my xampp directory. Modified the php.ini and added extension=php_mongodb.dll. Downloaded the composer but just when the composer installer does its work, it gives me the error.

I tried the x64 TS (I checked my phpinfo and its thread safe) because my laptop is 64 bit but it gives me an error

Program Output: PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_mongodb.dll' - %1 is not a valid Win32 application. in Unknown on line 0

Tried the x84 as well (i know it wont work but i tried nontheless) and it gives me an error

The ordinal 4694 could not be located in the dynamic link library C:\xampp\php\ext\php_mongodb.dll

Followed by another pop-up after the mentioned error above

PHP Startup: Unable to load dynamic library C:\xampp\php\ext\php_mongodb.dll - The operating system cannot run %1

My PHP Version is PHP Version 5.6.3

Xampp Version v3.2.1 Compiled May 7th 2013

I tried other mongoDB php driver php_mongo.dll, it works fine and is loaded when i do php_info. I wanted to use the php_mongodb.dll since the other is depreciated.

  • 写回答

1条回答 默认 最新

  • duanhongqiong9460 2018-02-07 21:15
    关注
    1. Download the mongo driver for Windows from pecl.php.net
      Download the latest stable release by clicking on the DLL link. On the next page there is a DLL list. Make sure to pick the correct one depending on:

      • the PHP version that is installed with your XAMPP,
      • Architecture x86 or x64,
      • whether Thread Safety is enabled or disabled.
        When Thread Safety is enabled, you need to download Thread Safe (TS) version.
    2. Unzip the downloaded mongo driver version and copy .dll file to XAMPP. After the successful download, unzip and find the .dll file. Copy it to the ext directory of your XAMPP installation. If you installed XAMPP to C drive, the full path to the ext folder would be C:\xampp\php\ext

    3. Register the mongodb.dll file within php.ini Add the following line into php.ini file:

      extension=php_mongodb.dll

    4. Restart XAMPP and refresh the phpinfo.php page When you restart XAMPP and refresh the phpinfo page, click CTRL+F and type mongodb, you should find infos about the just installed MongoDB Driver.

    5. Install MongoDB on Windows

    Note, this is quite similar to that what you did. It is essential to match the dependencies. This process worked for me several times already.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog