The following column Laravel Tutorial will introduce to you the problems encountered in laravel8. Friends help!
Currently, the official website of laravel8.x recommends using docker and laravel sail packages to install laravel. My operating system is windows 10, and I encountered many problems during the installation process. If you follow the steps, the installation is like this.
1. First install docker. Of course, docker does not support windows, so you need to install an auxiliary WSL2, which is similar to installing and using linux software on windows, and also install a linux operating system, similar to ubunut. of. This is more complicated. It was already complicated enough using laravel homestead before. I think this version will be simpler, but it feels more complicated.
2. The next step is to install a Linux system from the windows store. I chose ubuntu. The process is not that complicated.
3. Install a windows terminal. If you used cmd before, problems would occur, so install a windows terminal from the windows store. Here you can choose to enter commands from the ubuntu command terminal.
4. Make sure there is WSL2 support in docker settings. Fortunately, this is good by default. There is also a choice of ubuntu as the operating system, just check it.
Finally, use the windows terminal to select ubuntu and enter the installation command:
curl -s https://laravel.build/example-app | bash
This will create an example-app laravel project in your working directory, and then cd into it to execute the command:
cd example-app ./vendor/bin/sail up
If everything goes well, just visit localhost and your laravel will be installed.
But you still need to use a mysql client to manage the database, otherwise it will be very troublesome to keep entering commands in docker.
I used the navicat client to remotely enable the local docker database permissions. Yes, you heard it right, it is to remotely manage the local database locally. Here are some good methods you can tell me.
The problem now is that every time you use the
./vendor/bin/sail up
and
curl -s https://laravel.build/example-app | bash
commands, it will take a lot of time to install this and that of Linux. I don’t know if there is a permanent solution.
I currently use Laragon, and found that it would be very convenient to create an environment with this software.
Another problem is that when there are multiple projects, it will definitely not work if they all use localhost. It is said that multiple ports need to be changed, similar to one for 80 and one for 81. Modify the port under the directory. docker configuration file.
Then if you want to change the php configuration, apache configuration and so on, you need to use the ubuntu command line to modify it. There is no intuitive interface to change it directly.
Also, it feels inconvenient to create local domain names such as laravel.test.
I hope there is a simpler way to solve these problems. ’ ’s ’ ’s ’ ‐ to
The above is the detailed content of Analyze the problems encountered by laravel8.X about using docker to install and integrate the local development environment according to the official website. For more information, please follow other related articles on the PHP Chinese website!