+ 15

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.

23rd Jan 2021, 2:43 AM
David Carroll
David Carroll - avatar
5 Respostas
+ 6
You can install PECL extensions from the terminal. pecl install mongodb You will still need to edit php.ini though.
23rd Jan 2021, 9:23 AM
Ore
Ore - avatar
+ 5
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
23rd Jan 2021, 8:12 AM
Sonic
Sonic - avatar
+ 5
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.
23rd Jan 2021, 4:05 PM
David Carroll
David Carroll - avatar
+ 2
Yes David Carroll, in the PHP world, extensions are very different from dependencies.
23rd Jan 2021, 5:12 PM
Ore
Ore - avatar
- 1
Flooowoing is webely byr newuiru is listinxg of risting hiwbly
29th May 2021, 2:28 AM
William Brown