Windows PHP7 Installing MongoDB extensions
- Determine your own version (my version is php-7.1.9-win32-vc14-x64) If you do not know can open phpinfo view nts (non-threaded) TS (thread)
- Download the corresponding version of the Php_mongodb.dll file download link: https://pecl.php.net/package/mongodb/1.2.9/windows (According to my PHP version I chose php7.1 that column thread safety type) (download needs FQ, if not FQ please leave a message or add qq:1534147975)
- Extract the files and copy the Php_mongodb.dll files to the Ext directory under the PHP installation directory.
- Open PHP.ini profile Add line: Extension=php_mongodb.dll (The following files will be found in the PHP root directory: php.ini-production, which can be renamed to php.ini)
- Restart, and then open phpinfo () to see if there is a mongodb extension. Or, use PHP7 syntax to connect to the database when building PHP files:
<?php$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");//连接默认主机和端口为:mongodb://localhost:27017?>
The installation succeeds if no error occurs.
Windows PHP7 Installing MongoDB extensions