By nawfal
Hi,
Please I would like to know how could I install the extension and the library of MongoDB on App Platform with PHP.
I’ve tested this composer.json and it doesn’t work:
code
{
"require": {
"ext-mongodb": "*"
}
}
I’ve also tested “ext-mongo” instead of “ext-mongodb”. And also “ext-mongodb”: “^1.10.0”.
It displays me this error: “Build Error: Non-Zero Exit”.
The MongoDB database is on Digitalocean, and it’s linked to the app as a component.
Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
👋 @nawfal
I don’t think that error is related to the MongoDB. Build Error: Non-Zero Exit means that during build/detection the app errored, since PHP apps generally don’t compile, this is commonly caused by a missing composer.lock file.
Also, DigitalOcean MongoDB instances require connecting with a CA certificate. You can use bind variables to inject it by creating an environment variable like: CA_CERT=${db-mongodb-nyc1-12345.CA_CERT}.
Hope this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
