当前位置:网站首页>Solve the problems encountered by the laravel framework using mongodb
Solve the problems encountered by the laravel framework using mongodb
2022-07-04 03:06:00 【OwenZhang24】
As I said before , I always will macOS As a development platform , Directly in macOS The system configuration Nginx PHP And MySQL, Because of the needs of the project , Need to be used MongoDB, This is one of them macOS Running under the system Laravel Frame usage MongoDB A running book for solving problems .
In order not to pollute the officially developed code , I have a new one Laravel engineering , The version is 5.5 LTS,MongoDB The extension uses **laravel-mongodb**, According to the document , The command to install the extension is :
composer require jenssegers/mongodb
- 1.
But as soon as this order is executed , There are a lot of mistakes :
zocoMac:laravel-test zoco$ composer require jenssegers/mongodb
Using version ^3.4 for jenssegers/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- jenssegers/mongodb v3.4.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2].
- jenssegers/mongodb v3.4.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2].
- jenssegers/mongodb v3.4.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1, 1.4.2].
- mongodb/mongodb 1.4.2 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.4.1 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.3.2 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.3.1 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.3.0 requires ext-mongodb ^1.4.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.2.0 requires ext-mongodb ^1.3.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.1.2 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.1.1 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.1.0 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.5 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.4 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.3 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.2 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system.
- Installation request for jenssegers/mongodb ^3.4 -> satisfiable by jenssegers/mongodb[v3.4.0, v3.4.1, v3.4.2].
To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/7.1/php.ini
- /usr/local/etc/php/7.1/conf.d/ext-opcache.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
It can be seen that , This step is to expand the dependency PHP Of MongoDB Expand , Then let's start to install it .
macOS System installation PHP Of MongoDB Expand
Last time , My current development environment is direct use Homebrew Installed Nginx、PHP、MySQL And so on , Before, it could be used directly brew Install the corresponding PHP Extended , for instance :
brew install php71-mongodb
- 1.
But from Homebrew 1.5.0 Start , This method has been abandoned , Will prompt Error: No available formula with the name “php71-mongodb”. If the system doesn't come with its own extensions , We need to use it by hand pecl install , according to PHP Official documents , stay macOS/Linux/Unix Under the system , Just this line of command :
sudo pecl install mongodb
- 1.
Of course , That's just the general situation , In the case of domestic characteristic network , If it runs directly, it is likely to report an error due to network reasons , It's recommended to hang a command line dl Try installing again . If you can't download it , You can also go to here Download the corresponding version of the source package for manual installation .
If the automatic installation is successful , Finally, I see such an output :
Build process completed successfully
Installing '/usr/local/Cellar/[email protected]/7.1.22/pecl/20160303/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.5.3
Extension mongodb enabled in php.ini
- 1.
- 2.
- 3.
- 4.
Now that it's done ,PHP There must be a corresponding MongoDB Module , Use... On the command line php -m You can list all installed modules .
Next , Run which line above again composer Installation command :
zocoMac:laravel-test zoco$ composer require jenssegers/mongodb
Using version ^3.4 for jenssegers/mongodb
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install jenssegers/mongodb v3.4.2
- Conclusion: don't install jenssegers/mongodb v3.4.1
- Conclusion: remove laravel/framework v5.5.43
- Installation request for jenssegers/mongodb ^3.4 -> satisfiable by jenssegers/mongodb[v3.4.0, v3.4.1, v3.4.2].
- Conclusion: don't install laravel/framework v5.5.43
- jenssegers/mongodb v3.4.0 requires illuminate/events ^5.6 -> satisfiable by illuminate/events[v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.2, v5.7.3, v5.7.4, v5.7.5].
- don't install illuminate/events v5.6.0|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.1|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.10|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.11|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.12|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.13|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.14|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.15|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.16|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.17|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.19|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.2|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.20|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.21|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.22|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.23|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.24|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.25|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.26|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.27|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.28|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.29|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.3|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.30|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.31|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.32|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.33|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.34|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.35|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.36|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.37|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.38|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.4|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.5|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.6|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.7|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.8|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.6.9|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.7.0|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.7.1|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.7.2|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.7.3|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.7.4|don't install laravel/framework v5.5.43
- don't install illuminate/events v5.7.5|don't install laravel/framework v5.5.43
- Installation request for laravel/framework (locked at v5.5.43, required as 5.5.*) -> satisfiable by laravel/framework[v5.5.43].
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
I searched the dog and found nothing wrong , But I stumbled upon a solution , Is to install the specified version of jenssegers/mongodb, Because of my Laravel Version is 5.5.x, The best thing is to install 3.3.x Version of jenssegers/mongodb, The order is as follows :
composer require jenssegers/mongodb=3.3.*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing mongodb/mongodb (1.4.2): Downloading (100%)
- Installing jenssegers/mongodb (v3.3.1): Downloading (100%)
jenssegers/mongodb suggests installing jenssegers/mongodb-session (Add MongoDB session support to Laravel-MongoDB)
jenssegers/mongodb suggests installing jenssegers/mongodb-sentry (Add Sentry support to Laravel-MongoDB)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: jenssegers/mongodb
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
Now it's finally installed jenssegers/mongodb.
Later check jenssegers/mongodb Only when it comes to documents , stay jenssegers/mongodb The document installation command lists the corresponding Laravel Compatible versions , I just didn't read the document carefully :
Laravel version Compatibility
Laravel
Package
4.2.x
2.0.x
5.0.x
2.1.x
5.1.x
2.2.x or 3.0.x
5.2.x
2.3.x or 3.0.x
5.3.x
3.1.x or 3.2.x
5.4.x
3.2.x
5.5.x
3.3.x
5.6.x
3.4.x
According to this table , Which version Laravel Which version of jenssegers/mongodb Developers have clear instructions , If your Laravel Version is not consistent with mine , You may need to change to the corresponding version number after the above installation command .
Buy me a cup of coffee :)
边栏推荐
- Command Execution Vulnerability - command execution - vulnerability sites - code injection - vulnerability exploitation - joint execution - bypass (spaces, keyword filtering, variable bypass) - two ex
- false sharing
- Global and Chinese market of contour projectors 2022-2028: Research Report on technology, participants, trends, market size and share
- The 37 year old programmer was laid off, and he didn't find a job for 120 days. He had no choice but to go to a small company. As a result, he was confused
- Setting methods, usage methods and common usage scenarios of environment variables in postman
- Global and Chinese market of thin film deposition systems 2022-2028: Research Report on technology, participants, trends, market size and share
- [latex] production of complex tables: excel2latex and detail adjustment
- FRP intranet penetration
- Amélioration de l'efficacité de la requête 10 fois! 3 solutions d'optimisation pour résoudre le problème de pagination profonde MySQL
- Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
猜你喜欢

How to use websocket to realize simple chat function in C #

(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)

Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
![Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine](/img/3a/cf6285ae1c01bda42874eeca9fe5b1.jpg)
Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine

1day vulnerability pushback skills practice (3)

Kiss number + close contact problem

WordPress collection WordPress hang up collection plug-in

96% of the collected traffic is prevented by bubble mart of cloud hosting

MySQL workbench use
![Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]](/img/ad/b675364fcaf5d874397fd0cbfec11b.jpg)
Stm32bug [stlink forced update prompt appears in keilmdk, but it cannot be updated]
随机推荐
There is no need to authorize the automatic dream weaving collection plug-in for dream weaving collection
STM32 key content
How to use websocket to realize simple chat function in C #
Network communication basic kit -- IPv4 socket structure
A brief talk on professional modeler: the prospect and professional development of 3D game modeling industry in China
Global and Chinese market of cell scrapers 2022-2028: Research Report on technology, participants, trends, market size and share
Résumé: entropie, énergie libre, symétrie et dynamique dans le cerveau
Comment la transformation numérique du crédit d'information de la Chine passe - t - elle du ciel au bout des doigts?
The difference between int (1) and int (10)
In my spare time, I like to write some technical blogs and read some useless books. If you want to read more of my original articles, you can follow my personal wechat official account up technology c
static hostname; transient hostname; pretty hostname
Crawler practice website image batch download
1day vulnerability pushback skills practice (3)
Rhcsa day 2
The 37 year old programmer was laid off, and he didn't find a job for 120 days. He had no choice but to go to a small company. As a result, he was confused
Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
Design and implementation of redis 7.0 multi part AOF
[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)
Data collection and summary
[untitled] the relationship between the metauniverse and digital collections