Is there a preferred command line approach for automating the installation of the MongoDB PHP Driver?
While composer is used to install the MongoDB PHP Library, I'm wondering if there is a similar way to install the PHP extension. Currently, my process involves downloading the extension from the link below: https://pecl.php.net/package/mongodb Extracting the file from compressed archive file, moving it to the php/ext folder, updating the php.ini file, and restarting apache. Then, I have to install the MongoDB PHP Library via Composer. Since I've not actively been working with PHP over the past few years, I'm not aware of emerging or current best practices for automating this entire setup.
1/23/2021 2:43:35 AMDavid Carroll
5 AnswersNew Answer
You can install PECL extensions from the terminal. pecl install mongodb You will still need to edit php.ini though.
Would writing a script with the commands in this document work? https://kb.objectrocket.com/mongo-db/how-to-install-the-mongodb-driver-for-php-292
Sonic The solution I'm looking for would certainly be part of custom scripts like the ones in that article. However, I'm looking for a package manager CLI to automatically handle all dependencies (library and extensions) for the MongoDB Driver in PHP similar to npm, pip, nuget, gem, gradle, etc. I originally thought Composer was that solution for PHP. However, I've come to discover that the MongoDB PHP Driver is split into a PECL installed extension and a Composer installed library. I was hoping there was a single CLI command to handle the installation and setup of both dependencies. Ore Thanks for clarifying PECL is the preferred CLI installer for extensions. 👌 I suppose PECL is separately required to manage the low level extensions for PHP which may be meant to be isolated from the higher level PHP library packages managed by Composer.
Yes David Carroll, in the PHP world, extensions are very different from dependencies.
Hakmi Dalia You have the nerve to be spamming in the thread of a gold moderator. You clearly have no regard for Sololearn's rules. If you do not delete your messages your account may get banned.