当前位置:网站首页>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 :)
边栏推荐
- 基於.NetCore開發博客項目 StarBlog - (14) 實現主題切換功能
- [Yugong series] February 2022 attack and defense world advanced question misc-84 (MySQL)
- Dans la recherche de l'intelligence humaine ai, Meta a misé sur l'apprentissage auto - supervisé
- Zblog collection plug-in does not need authorization to stay away from the cracked version of zblog
- Setting methods, usage methods and common usage scenarios of environment variables in postman
- Handler source code analysis
- MySQL workbench use
- [development team follows] API specification
- This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t
- 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?
猜你喜欢
96% of the collected traffic is prevented by bubble mart of cloud hosting
PHP database connection succeeded, but data cannot be inserted
The first spring of the new year | a full set of property management application templates are presented, and Bi construction is "out of the box"
How to use websocket to realize simple chat function in C #
Lichuang EDA learning notes 14: PCB board canvas settings
[latex] production of complex tables: excel2latex and detail adjustment
Advanced learning of MySQL -- Application -- index
This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t
[Yugong series] February 2022 attack and defense world advanced question misc-83 (QR easy)
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
随机推荐
長文綜述:大腦中的熵、自由能、對稱性和動力學
Unspeakable Prometheus monitoring practice
Setting methods, usage methods and common usage scenarios of environment variables in postman
Pagoda SSL can't be accessed? 443 port occupied? resolvent
Unity controls the selection of the previous and next characters
Design and implementation of redis 7.0 multi part AOF
Global and Chinese market of handheld melanoma scanners 2022-2028: Research Report on technology, participants, trends, market size and share
Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine
Leetcode 110 balanced binary tree
ZABBIX API pulls the values of all hosts of a monitoring item and saves them in Excel
Baijia forum the founding of the Eastern Han Dynasty
Create real-time video chat in unity3d
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
Node write API
static hostname; transient hostname; pretty hostname
150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)
Unity writes a character controller. The mouse controls the screen to shake and the mouse controls the shooting
Jenkins continuous integration environment construction V (Jenkins common construction triggers)
[UE4] parse JSON string