Hey guys, new guy here so please bear with me.
I have a plain web page hosted on hostinger.
It supports php 8.0 and has a mongdb extension which I have enabled.
I tried connecting to my atlas server with a simple test.php code. All I get is some sort of unable to load page, http 500 error. I tried different variations of the code. My impression is that this extension is not properly installed, or rather, I have to install it and maybe I have no clue how to. Any tips?
Should I have signed up for a dedicated server and installed the mongodb php driver through a shell? I have the basic hosting plan I think, not sure I get a dedicated server. But it shouldn’t be hard to make a simple php code and connect to my atlas server right? Is a dedicated server for the php page a must? Seems like overkill to me.
Thanks in advance,
Marcelo
Update: I have managed to use the ssh to connect to my host. I have succesfully installed the package with the composer. Now the problem seems to be on the code itself I guess. Although I still get the very same http 500 error.
Here’s the code nevertheless:
Did I miss anything? I simply used the command composer require mongodb/mongodb and installed it through ssh.
Hi Marcelo,
Were you able to resolve this issue… I am facing the same…
any solution to this ?
goto it … instead of client we must use MongoDB\Driver\Manager
source: php - Class 'MongoDB\Client' not found, mongodb extension installed - Stack Overflow
I had the same problem. Solution: go to the advanced settings of website, then php configuration. Enable mongodb in PHP extensions and then install mongodb with composer
MongoDB Driver that Hostinger uses is not the last version available. If you use a shared host, you need to downgrade to match their version, otherwise it will return messages as if it wasn’t installed.
In my website the version is 1.18.1 for example. You should use libs versions compatible with the version in your website.
If you use a VPS, then you can install the latest version.
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
Node js driver lacks type definitions for aggregation pipeline stages | 0 | 78 | Aug 2024 |
Buffering timed out after 10000ms 8.7.0 mongoose node 20.10.0 | 2 | 204 | Jan 18 |
POCO to BsonDocument Convert Object to Bson unexptected behaviour with float and decimal | 0 | 28 | Nov 2024 |
How to get error message when using schema validation in mongo db? | 0 | 38 | Dec 2024 |
MongoDB Client-Side Field Level Encryption with ASP.NET core C# in docker on ARM64 | 3 | 33 | 1d |