skip to Main Content

I have an issue with connecting php(valet) and MongoDB. I tried to install MongoDB with pecl and command sudo pecl install mongodb and brew install mongodb and all time I get some errors during the install process:

In file included from /private/tmp/pear/temp/mongodb/src/MongoDB/Cursor.c:18: /opt/homebrew/Cellar/[email protected]/8.0.17/include/php/ext/spl/spl_iterators.h:151:4: error: unknown type name 'pcre_cache_entry' pcre_cache_entry *pce; ^ 1 error generated. make: *** [src/MongoDB/Cursor.lo] Error 1 ERROR: make’ failed`.

But when I run mongo --version I get:
enter image description here
and I install MongoDB Compass and as you can see, I can connect to the database and write into it:
enter image description here
But when I try out to install laravel package jenssegers/mongodb I get these errors:enter image description here I tried with --ignore-platform-req=ext-mongodb flag but then it install package but it didn’t work, I get this error: Error: Class "MongoDBDriverManager" not found.

2

Answers


  1. Chosen as BEST ANSWER

    Finally, I find out a great package that helps me in this! This repo saves me a ton of time and debugging! Thank you shivammathur!


  2. Hey I also had the same problem. A good alternative is to also follow with this article if you want to stick with pecl https://freek.dev/2151-fixing-the-dreaded-pcre2h-file-not-found-error-when-installing-imagick

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search