I try to configure VSCode to use our php executable inside a docker container. Firstly i tried it on a macintosh and everything works as expected. At work we use windows pc´s and i cant get it to work. Workspace Settings
I tried to set a php.bat
php.sh
Anybody of you can help me get this to work? We would like to change our IDE from PHPStorm to VSCode but we arent able to so because everything a developer needs is stored in docker containers. asked Nov 27, 2018 at 14:28 Stillmatic1985Stillmatic1985 1,7226 gold badges20 silver badges37 bronze badges I came up with a solution on Linux for multiple laravel sail projects. Create a file named 'php' on /usr/local/bin
Make it executable:
Edit the file (with sudo) and paste this code:
Now just run, example, 'php -v' inside the laravel sail project. answered Feb 25, 2021 at 21:02 6 If you are running Docker on Windows and WSL2 you should replace the underscores for dash like this:
It took me a while to find out, i hope this can help someone. answered Jul 18 at 0:13 0 I had the exact same issue, and just found a solution, but in my case I'm working under the Windows Subsystem for Linux, not straight Windows, so I'm not sure if/how it would be adapted. You can read more about it here: set PHP path from host to docker container For me, the part that seemed to resolve the problem was moving the "wrapper" to I hope that might help you! Update: I just saw someone in the comments was working in Windows! They suggested putting
into a .bat file; looking at what you've already done, the difference appears to be using answered Jul 22, 2020 at 21:44 1 Skip to content I Love VSCode and I am sure you do too which is probably the reason why you are reading this. I have been an avid user of VSCode for several years now and I love the flexibility it provides with third party extensions and plugins. I have to wirte a lot of PHP code for a bunch of different projects and I like to use docker for local development environment. Docker makes it very easy to emulate production environments on your local machine which is the primary reason I have ditched VirtualBox completely for the past couple of years and switched to docker completely. After moving to docker I could not find a proper way to add the PHP support to VSCode as it requires an To overcome this issue all you need to do is to create a file in you project directory by the name of `php` and add the following code to it #!/bin/bash docker exec -it web_app php [email protected] `web_app` is the name of the container that has PHP installled in it. Now we need to make this file executable if you are on linux or mac using this command `chmod +x /path/to/project/php`. Now you can update the `executablePath` and set its value to this new file that you have just created "php.validate.executablePath": "./php" Now you should have the PHP support in VSCode without installing PHP on your local machine. If you know of a better way to do this, Please share in comments. Copyright © 2022 Web Developer Pal I try to configure VSCode to use our php executable inside a docker container. Firstly i tried it on a macintosh and everything works as expected. At work we use windows pc´s and i cant get it to work. Workspace Settings
I tried to set a php.bat
php.sh
Anybody of you can help me get this to work? We would like to change our IDE from PHPStorm to VSCode but we arent able to so because everything a developer needs is stored in docker containers. asked Nov 27, 2018 at 14:28
Stillmatic1985Stillmatic1985 1,7226 gold badges20 silver badges37 bronze badges I came up with a solution on Linux for multiple laravel sail projects. Create a file named 'php' on /usr/local/bin
Make it executable:
Edit the file (with sudo) and paste this code:
Now just run, example, 'php -v' inside the laravel sail project. answered Feb 25, 2021 at 21:02
6 If you are running Docker on Windows and WSL2 you should replace the underscores for dash like this:
It took me a while to find out, i hope this can help someone. answered Jul 18 at 0:13
0 I had the exact same issue, and just found a solution, but in my case I'm working under the Windows Subsystem for Linux, not straight Windows, so I'm not sure if/how it would be adapted. You can read more about it here: set PHP path from host to docker container For me, the part that seemed to resolve the problem was moving the "wrapper" to I hope that might help you! Update: I just saw someone in the comments was working in Windows! They suggested putting
into a .bat file; looking at what you've already done, the difference appears to be using answered Jul 22, 2020 at 21:44
1 |