Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PitykePadavan's avatar

php in Laravel 9 (with Docker + WSL2)

I installed Laravel 9 to my Windows, using Docker and WSL2 according to the docs Everything went super smoothly.

So when I practise Laravel:

  • Open WSL2 terminal
  • Start Docker
  • Go to the Laravel directory, and open VS Code with the .code command
  • Start my Laravel app using sail up (sail is an alias for ./vendor/bin/sail)
  • And I can do stuff.

I started to watch the VS Code series recently, and I realized that I have some problems with php.

For example using the Laravel Artisan extension which allows me to run Laravel Artisan commands within VS Code. With the extension if I want to get my route list entering CTRL+SHIFT+P and typing >route list is not working because it doesn't find the php command. I can't type anything php related to my command line. I cant type php -v but I can use sail php -v.

The problem is that php doesnt exists outside of the docker container (which is fine i think), it only exists inside the container, and I can use it via the sail php command. But I cannot use extensions because they rely on the php command.

I hope what I wrote makes sense, and you can suggest me some workaround or a solution.

0 likes
1 reply

Please or to participate in this conversation.