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 |
---|---|---|---|
MongoNetworkError: read ECONNRESET after upgrade mongdb nodejs driver to 6 or above | 2 | 1.3k | Apr 2024 |
I issue with memory leaks after updating mongoDB driver | 0 | 395 | Aug 2024 |
How to use multiple custom Mongoose Schemas as sub-schemas for the type field instead of Schema.Types.Mixed? | 0 | 30 | Dec 2024 |
Is there a way to replace Pthread threading backend to OpenMP? | 2 | 54 | Feb 10 |
How to use mongocrypt_setopt_key_expiration settings using MongoDB.Driver for .NET | 4 | 59 | 14d |