当前位置:网站首页>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 :)
边栏推荐
- Contest3145 - the 37th game of 2021 freshman individual training match_ E: Eat watermelon
- The difference between MCU serial communication and parallel communication and the understanding of UART
- FRP intranet penetration
- Network byte order
- Is online futures account opening safe and reliable? Which domestic futures company is better?
- Create real-time video chat in unity3d
- [Yugong series] February 2022 attack and defense world advanced question misc-83 (QR easy)
- Database concept and installation
- What is the difference between enterprise wechat applet and wechat applet
- Solve the problem that the tabbar navigation at the bottom of vantui does not correspond to the page (window.loading.hash)
猜你喜欢
C learning notes: C foundation - Language & characteristics interpretation
Pagoda SSL can't be accessed? 443 port occupied? resolvent
Fudan released its first review paper on the construction and application of multimodal knowledge atlas, comprehensively describing the existing mmkg technology system and progress
Www 2022 | taxoenrich: self supervised taxonomy complemented by Structural Semantics
C language black Technology: Archimedes spiral! Novel, interesting, advanced~
Command Execution Vulnerability - command execution - vulnerability sites - code injection - vulnerability exploitation - joint execution - bypass (spaces, keyword filtering, variable bypass) - two ex
Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]
Practical multifunctional toolbox wechat applet source code / support traffic master
MySQL data query optimization -- data structure of index
[Yugong series] February 2022 attack and defense world advanced question misc-83 (QR easy)
随机推荐
Rhcsa day 2
[untitled] the relationship between the metauniverse and digital collections
60 year old people buy medical insurance and recommend a better product
[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)
Stm32bug [the project references devices, files or libraries that are not installed appear in keilmdk]
Mysql to PostgreSQL real-time data synchronization practice sharing
Unity writes a character controller. The mouse controls the screen to shake and the mouse controls the shooting
96% of the collected traffic is prevented by bubble mart of cloud hosting
Global and Chinese market of handheld melanoma scanners 2022-2028: Research Report on technology, participants, trends, market size and share
PID of sunflower classic
Contest3145 - the 37th game of 2021 freshman individual training match_ D: Ranking
[development team follows] API specification
Kiss number + close contact problem
Teach you how to optimize SQL
Global and Chinese markets for electroencephalogram (EEG) devices 2022-2028: Research Report on technology, participants, trends, market size and share
Contest3145 - the 37th game of 2021 freshman individual training match_ G: Score
Sword finger offer:55 - I. depth of binary tree
Enhanced for loop
POSTECH | option compatible reward reverse reinforcement learning
C # learning notes: structure of CS documents