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:
and I install MongoDB Compass and as you can see, I can connect to the database and write into it:
But when I try out to install laravel package jenssegers/mongodb
I get these errors: 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 "MongoDB\Driver\Manager" not found
.
CodePudding user response:
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!
CodePudding user response:
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