Developing on Windows with WSL2 (Subsystem for Linux) and PHP

preview_player
Показать описание
Developing on Windows with WSL2 (Subsystem for Linux) and a PHP LAMP stack on wsl2. Adam Culp of Beachcasts PHP programming videos shares how to set up a local development environment with PHP on WSL 2, also known as Windows Subsystem for Linux, and installs a Laravel framework project for local development. By installing a full lamp stack on WSL 2. In this Laravel howto we will set up Apache, and PHP on Ubuntu using WSL, for an awesome WSL 2 local dev environment. I also show how to launch VS Code and Windows Explorer from within Ubuntu running inside WSL 2.

Please * LIKE, COMMENT, AND SUBSCRIBE * - and share with others!

Key Topics:
- Creating a development environment using Ubuntu running on WSL 2
- Installing LAMP in WSL 2
- Creating a symbolic link to a working directory on a Windows host
- Setting up the userdir extension for Apache 2
- Install and configure a Laravel based application on Ubuntu within WSL 2
- Launching Windows-based tools from within WSL 2 via CLI

Errata:
Let me know if you notice anything that should be errata

Associated Links:

Timeline:
00:00 Intro
01:25 Prerequisites for setting up a development environment in WSL 2
02:17 Installing Apache 2 on Ubuntu in WSL 2
02:55 Install PHP in WSL 2
04:21 Creating a working directory on Windows (host) to use within Ubuntu (WSL)
05:33 Add a symbolic link to the directory on the Windows host
08:13 Activate userdir extension for Apache 2
09:04 Configure the userdir extension
11:47 How to install Composer dependency manager for PHP globally
14:11 Installing the Dom extension (XML extension) for PHP, and unzip utility for Ubuntu
15:47 Creating a Laravel based application on Ubuntu within WSL
17:31 Notes about rendering speeds using WSL 2
18:57 Alternative methods for serving websites from WSL 2
19:55 Launching VS Code from within a WSL 2 environment over CLI
21:06 Launching Windows Explorer from within WSL 2 to view files on Windows host

Other Beachcasts videos you might find interesting:

Help through referrals:

#php #wsl2 #beachcasts
Рекомендации по теме
Комментарии
Автор

Adam's WIN10 WSL videos are exceptional in my opinion - very, very informative to a new WSL person like myself, and his audio and video are very professional, his tech comments are brief, concise, and extremely useful, and his screen shots of his typed keyboard input commands as he explains his concepts are very helpful. I would highly recommend his WSL videos...

bobjohnson
Автор

this was not only informative and accurate but also enjoyable to watch! You sir could be a teacher!

MET
Автор

I am a .net programmer. I use VS Code and Visual Studio as my main tools. Then comes along this php customer. I saw this video and had the WSL2 environment and lamp stack (I added Mariadb) running in an hour. The only hang up was that I couldn't get past permissions issues with composer on an NTFS volume. Maybe you covered this in an earlier video, but I had to make a /etc/wsl.conf with [automount] options="metadata" to get composer to run. BOOM! I am ready to rock tomorrow! Thank you!

shawnwbailey
Автор

This entire video has been priceless. Thank you for all of your time and efforts in making it.

dannyvsr
Автор

Very well done! Super easy to follow along and very clear. Looking forward to more videos. I would love to see a video about using setting up ATOMIC in WSL2 and maybe linking cudann/cuda to things. (ML Video)

ChadALozano
Автор

I am very new in php world and had lots of questions about it. But with this video i found answers to my questions. Thank you so much @Beachcasts.

bedrettingulen
Автор

For those experiencing "FORBIDDEN" issues, simply type "cd" to return to your user's initial home directory and then go back one folder using "cd ../". After that, execute the command "chmod +x youruser".

caminhodaslutas
Автор

Great video! Really helped me get a better understanding of things. Just a note, you need to start apache2 after installation which was a step not covered.
```sudo service apache2 start```

OliverRivettCarnac
Автор

Perfect! Thanks a lot! Next step - docker-compose and abilitty to make custom configs on projects with reusable images/containers.

alexwisard
Автор

very clean lesson, I've been setting it up several times already, many thanks!

danzeel
Автор

I have an old php application, which I think I used either a package for laravel on Mac or some sort of dist setup using Docker on Windows. Either way, it does not have the necessary files/setup that is automated using composer such as you did. Can you go over how to prepare a project from scratch (not downloading from laravel) so that it will load properly on localhost?

evanmarshall
Автор

I liked Your explanation method, video quality, your voice very understandable

KBPNB
Автор

Thank you for the great information, very clear, very concise and very informative. I hope you have an amazing new year.

MegaAnand
Автор

I think in your tutorial missed the step which explain how to start apache, because in other case localhost is not show apache page. In ubuntu console need to write "sudo service apache2 start"". In any case it was very HELPFUL for me!

danzeel
Автор

That's exactly what I was looking for! Thank you so much!

RobertoDeMontecarlo
Автор

Thanks for the video. Great information. Question? I get a message in VS Code. It does not like the Projects file being in windows. Message: This workspace is on the Windows file system (/mnt/). For best performance, we recommend moving the workspace to the Linux file system (~/home). Any thoughts? Thanks

jdkarns
Автор

Great video, thank you for sharing!

For anybody wondering, you can still follow along without the symlink to a Window file system directory, serving the files in WSL, from WSL, with a few minor adjustments along the way. Microsoft's documentation for WSL states that they "recommend against working across operating systems with your files, unless you have a specific reason for doing so" for the fastest performance and speed. Are there any major consequences of this? I don't yet know.

chrisandrew_tv
Автор

thanks for the tutorial, it was very helpful. I loved the elephants 😁

tiagosoares
Автор

I'm experiencing the 'FORBIDDEN' issue that other people have faced. I gave execute permissions to my user chmod +x /home/myuser as suggested in the comments and this indeed solved the issue but I don't why. Can someone please explain why this works? Is it safe giving execute permissions to /home/myuser? If not safe or simply a bad practice is there a better solution?

viktornikolov
Автор

Thanks for sharing this...
Very helpful

hamdyahmed