1) C:\php5\session_cache folder must copy or create (huge project use this folder to handle session stuff, so must have it, default php install do not have this folder)
2)
NOTE: must add c:\php5\ path to environment variable at system path (environment variable)
Otherwise php.info will not load mongo.dll
at php.ini add follow line:
extension=php_mongo.dll
; must use php_mongo-1.6.8-5.5-vc11-x86_64 rename to php_mongo.dll 5.5 means current php 5.5 version. vc11 64
; NOTE: must add c:\php5\ path to environment variable at system path (environment variable)
to download php_mongo.dll go to
https://pecl.php.net/package/mongo
3)
php_mongodb.dll is NOT same as php_mongo.dll
mongodb.dll is newest libary. go to download dll, unzip, apache always use thread safe.
php_mongodb-1.2.5-5.5-ts-vc11-x64.
copy the dll to c:/php5/ext/
https://pecl.php.net/package/mongodb/1.2.5/windows
at php.ini add follow line:
extension=php_mongodb.dll
for mongodb.dll https://pecl.php.net/package/mongodb,
click DLL, download thread safe x64 version
for mongo.dll https://pecl.php.net/package/mongo
4)
use composer to install the lib
http://php.net/manual/en/mongodb.tutorial.library.php
http://php.net/manual/en/set.mongodb.php
C:\Users\HU_J>cd C:\Apache24\htdocs\civilpdf
C:\Apache24\htdocs\civilpdf>composer self-update
C:\Apache24\htdocs\civilpdf>composer require mongodb/mongodb
You are ready to use mongodb php lib
//######## sample for old and new mongo.dll mongodb.dll api ########################################
//---------old mongo.dll -------
// $m = new MongoClient();
// $db = $m->civilpdf;
// $collection = $db->pdf;
// $insert_One_PDF = $collection->insert([ ]};
//-------------------------------
//-----------------------+++++++++++++++ new mongodb.dll ++++++++++++++++++-------------------
// .....version 1
// $mongo = new MongoDB\Driver\Manager("mongodb://localhost:27017");
//
// $bulk = new MongoDB\Driver\BulkWrite;
// $bulk->insert([
// 'user_id' => $user_id,
// 'user_name' => $user_name,
//
// 'file_id' => $file_id,
// 'publicurl' => $publicurl,
// 'title' => $title,
// 'description' => $description,
// 'organization' => $organization,
// 'publish_year' => $publish_year,
// 'publish_month' => $publish_month,
// 'tag' => $tag,
// 'submit_time' => $submit_time,
//
//
//
// ]);
// $mongo-> executeBulkWrite("civilpdf.pdf", $bulk);
//............................
//..... version 2
// $client = new MongoDB\Client("mongodb://localhost:27017");
// $collection = $client->civilpdf->pdf;
//
//
// $insert_One_PDF = $collection->insertOne([
// 'user_id' => $user_id,
// 'user_name' => $user_name,
//
// 'file_id' => $file_id,
// 'publicurl' => $publicurl,
// 'title' => $title,
// 'description' => $description,
// 'organization' => $organization,
// 'publish_year' => $publish_year,
// 'publish_month' => $publish_month,
// 'tag' => $tag,
// 'submit_time' => $submit_time,
//
//
// ]);
//----------------------------------++++++++++++++++++++---------------------------------------------------
//############################ END ################### sample for old and new mongo.dll mongodb.dll api ########################################
=========================================================
No comments:
Post a Comment