{"id":15154087,"url":"https://github.com/mongodb/mongo-php-driver-legacy","last_synced_at":"2025-09-30T01:32:22.919Z","repository":{"id":495227,"uuid":"121842","full_name":"mongodb/mongo-php-driver-legacy","owner":"mongodb","description":"Legacy MongoDB PHP driver","archived":true,"fork":false,"pushed_at":"2022-01-31T17:54:30.000Z","size":10439,"stargazers_count":1085,"open_issues_count":0,"forks_count":326,"subscribers_count":119,"default_branch":"master","last_synced_at":"2024-12-20T20:04:32.092Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pecl.php.net/package/mongo","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongodb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-02-04T21:30:35.000Z","updated_at":"2024-10-08T19:30:54.000Z","dependencies_parsed_at":"2022-08-16T10:25:25.369Z","dependency_job_id":null,"html_url":"https://github.com/mongodb/mongo-php-driver-legacy","commit_stats":null,"previous_names":[],"tags_count":92,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fmongo-php-driver-legacy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fmongo-php-driver-legacy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fmongo-php-driver-legacy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb%2Fmongo-php-driver-legacy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongodb","download_url":"https://codeload.github.com/mongodb/mongo-php-driver-legacy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234687193,"owners_count":18871712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T17:01:54.687Z","updated_at":"2025-09-30T01:32:22.196Z","avatar_url":"https://github.com/mongodb.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# End of Life Notice\n\nThe legacy MongoDB PHP driver (i.e. `ext-mongo`) is now officially end-of-life (EOL). No further development, bug fixes, enhancements, documentation changes or maintenance will be provided by this project and pull requests will no longer be accepted.\n\nUsers are encouraged to migrate to [mongodb/mongo-php-driver](https://github.com/mongodb/mongo-php-driver) (i.e. `ext-mongodb`). \n\nFor historical reference, the documentation for this project has been archived in the `docs/` folder and may be viewed at: https://mongodb.github.io/mongo-php-driver-legacy/\n\n----\n\n## Installation\n\nTo build and install the driver:\n\n    phpize\n    ./configure\n    make\n    sudo make install\n\nThen, add the following to your `php.ini` file:\n\n    extension=mongo.so\n\n### Enabling enterprise features\n\nTo connect to MongoDB Enterprise using SASL (GSSAPI) or LDAP (PLAIN) you need\nto build the driver against cyrus-sasl2 (external library).\nThis is done by passing --with-mongo-sasl to ./configure, optionally passing\nin the directory to where cyrus-sasl2 was installed:\n\n    phpize\n    ./configure --with-mongo-sasl=/usr/local\n    make\n    sudo make install\n\n### Installing on Windows\n\nWindows builds are available through http://pecl.php.net/package/mongo.\n\nBuilds for older driver versions may be found through\nhttps://s3.amazonaws.com/drivers.mongodb.org/php/index.html.\n\nEach driver release includes various builds to support specific versions of PHP\nand Windows. Select the correct DLL file for your environment, and add the\nfollowing to your `php.ini` file (`VERSION` will vary by environment):\n\n    extension=php_mongo-VERSION.dll\n\nIf the DLL is not located within the directory specified by the\n[extension_dir](http://www.php.net/manual/en/ini.core.php#ini.extension-dir) INI\nsetting, you may need to specify its full path.\n\n## Documentation\n\nThis extension's documentation was previously hosted on PHP.net but has since\nbeen removed. The final version of the documentation is now published in the\n``docs/`` folder of this repository and available via GitHub pages:\nhttps://mongodb.github.io/mongo-php-driver-legacy/\n\n## How To Ask For Help\n\nWhen asking for support, or while providing feedback in the form of bugs or\nfeature requestes, please include the following relevant information:\n\n - Detailed steps on how to reproduce the problem, including a script that\n   reproduces your problem, if possible. \n - The exact PHP version used. You can find this by running `php -v` on the\n   command line, or by checking the output of `phpinfo();` in a script\n   requested through a web server.\n - The exact version of the MongoDB driver for PHP. You can find this by\n   running `php --ri mongo | grep Version` on the command line, or by running\n   a script containing `\u003c?php echo phpversion(\"mongo\"); ?\u003e`.\n - The operating system and version (e.g. Windows 7, OSX 10.8, ...).\n - How you installed the driver, either via your distribution's package\n   management, with \"brew\", with an \\*AMP installation package, or through a\n   manual source compile and install.\n - With connection and replica set selection issues, please also provide a\n   full debug log. See further down on how to make one.\n\n\n\n### Support / Feedback\n\nFor issues with, questions about, or feedback for the PHP driver, please look\ninto our [support channels](http://www.mongodb.org/about/support). Please do\nnot email any of the PHP driver developers directly with issues or\nquestions—you're more likely to get an answer on the \n[mongodb-user list](http://groups.google.com/group/mongodb-user) on Google\nGroups.\n\n\n### Bugs / Feature Requests\n\nThink you have found a bug? Want to see a new feature in the driver? Please\nopen a case in our issue management tool, JIRA:\n\n - Create an account and login (https://jira.mongodb.org).\n - [Create a new issue](https://jira.mongodb.org/secure/CreateIssue!default.jspa?pid=10007).\n\nBug reports in JIRA for all driver projects, as well as for the MongoDB server\nproject, are **public**. Please do not add private information to bug reports.\n\n\n## Security Vulnerabilities\n\nIf you’ve identified a security vulnerability in a driver or any other\nMongoDB project, please report it according to the \n[instructions here](http://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report).\n\n\n## Testing\n\nThe tests are not available as part of the PECL package, but they are available \non [Github](http://www.github.com/mongodb/mongo-php-driver/tree/master/tests).  \n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for how to run and create new tests.\n\n\n## Full debug log\n\nYou can make a full debug log by using the following code:\n\n\n```php\n\u003c?php\n/*\n * This script will catch all internal driver logging for MongoDB and log them\n * to a file /tmp/MONGO-PHP-LOG.\u003cunix-timestamp\u003e. This log will give the\n * driver developers more or less all the information they'll need to debug\n * this issue\n */\n \nfunction module2string($module)\n{\n    switch ($module) {\n        case MongoLog::RS: return \"REPLSET\";\n        case MongoLog::CON: return \"CON\";\n        case MongoLog::IO: return \"IO\";\n        case MongoLog::SERVER: return \"SERVER\";\n        case MongoLog::PARSE: return \"PARSE\";\n        default: return $module;\n    }\n}\n \nfunction level2string($level)\n{\n    switch ($level) {\n        case MongoLog::WARNING: return \"WARN\";\n        case MongoLog::INFO: return \"INFO\";\n        case MongoLog::FINE: return \"FINE\";\n        default: return $level;\n    }\n}\n \nfunction logMongo($module, $level, $message, $save = false) {\n    static $log = \"\";\n    $log .= sprintf(\"%s | %s (%s): %s\\n\", date('Y-m-d H:i:s',time()), module2string($module), level2string($level), $message);\n \n    if ($save) {\n        file_put_contents(\"/tmp/MONGO-PHP-LOG.\" . time(), $log);\n        $log = \"\";\n    }\n}\n \nfunction saveMongoLogException($ex) {\n    if ($ex instanceof MongoException) {\n        $msg = sprintf(\"Uncaught exception: %s, %s\\n\",  get_class($ex), $ex-\u003egetMessage());\n        logMongo(get_class($ex), \"ERROR\", $ex-\u003egetMessage(), true);\n    }\n    throw $ex;\n}\n\nfunction saveMongoLog() {\n    logMongo(\"EXIT\", \"EXIT\", \"EXIT\", true);\n}\n \nMongoLog::setLevel(MongoLog::ALL);\nMongoLog::setModule(MongoLog::ALL);\nMongoLog::setCallback(\"logMongo\");\n\nregister_shutdown_function(\"saveMongoLog\");\n \n/* If an global exception handler is used, or a default exception handler is\n * already registered, please comment out this line and put into your catch\n * block: saveMongoLogException($exception); */\nset_exception_handler(\"saveMongoLogException\");\n?\u003e\n```\n\n\n## Credits\n\nJon Moss\n\n* Came up with the idea and implemented `MongoCursor` implementing `Iterator`\n\nPierre-Alain Joye\n\n* Helped build the Windows extension and has provided the VC6 builds\n\nCesar Rodas\n\n* Created the `MongoCursor::info` method\n* Implemented GridFS read streaming\n\nWilliam Volkman\n\n* Made connection code check \u0026 handle error status\n\nDerick Rethans\n\n* Implemented `MongoInt32`, `MongoInt64` and related _php.ini_ options.\n\nTaneli Leppä\n\n* Provided a patch for PHP-706 to swap out select() for poll().\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb%2Fmongo-php-driver-legacy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongodb%2Fmongo-php-driver-legacy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb%2Fmongo-php-driver-legacy/lists"}