viperet / vscode-magento-wizard

Helps develop Magento 2 extensions using VSCode
36 stars 16 forks source link

Path executable php #42

Open ljr95 opened 1 year ago

ljr95 commented 1 year ago

Hi, Thank you very much for your extension.

I work with open vscode in wsl 2 and I use docker to run the different services like php.

I don't want to install php in my wsl2, so at the root of my project I have a ./php file containing:

!/bin/bash

docker exec -it php7.4-fpm php $@

This allows me to expose php access for other vscode extensions, like for php intellisense and it works great. Unfortunately this configuration does not work with the extension vscode-magento-wizard.

Here is the configuration: "php.validate.executablePath": "./php", "magentoWizard.tasks.php": "./php",

And the error message from the extension output: `undefined Looks like we don't have PHP executable available at './php'. Please set correct path in the extension settings. Many features would be unavailable without access to PHP executable. Found Magento root at /home/XXX/XXX/magento2

Do you know why this is not working? Thank you in advance for your help,

viperet commented 1 year ago

Hello @ljr95, can you try to put full absolute path to your ./php script in the "magentoWizard.tasks.php" parameter?

ljr95 commented 1 year ago

Hello @viperet , yes I also tried with the absolute path, but I have the same result :('

viperet commented 1 year ago

@ljr95 I suspect this is some Windows or WSL-specific issue in the extension. I'm not a windows guy at all, I haven't used Windows for ~10 years. But I have managed to install Windows 11 in Parallels, so if you can guide me on how to recreate your setup - I will try to fix the issue.

ljr95 commented 1 year ago

@viperet Sorry for my reply, I was very busy I will try to detail the working method, I hope I will be explicit enough for someone who does not work on windows.

You need to install WSL2 and a linux distro, in my case it's Ubuntu. https://learn.microsoft.com/en-us/windows/wsl/install

Then in that distro install docker docker-compose and vscode with the VS Code Remote Development extension. https://code.visualstudio.com/docs/remote/remote-overview

Do you have at your disposal a docker-compose to run a Magento2?

When your Magento is functional, from your distribution go to the directory containing Magento and enter "code ." This will allow you to open the directory locally (in the distribution) with VScode.

Create a file, for example "php" containing:

!/bin/bash

docker exec -it php8.1-fpm php $@

You have to adapt the "php8.1-fpm" part with the name of your container which contains php.

This "php" file will be our executable for php and will need to be configured in your vscode extension.

As indicated you can test with the intelephense extension to configure this "php" file as a php executable, it should normally work fine. https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client

Are my explanations clear enough? Thx,

jakeflynn123 commented 1 year ago

Hey, I've got this same issue I am running this docker container https://github.com/markshust/docker-magento with vscode on macOS Ventura 13.3.1

Heres my MagentoWizard Output

undefined Looks like we don't have PHP executable available at './php'. Please set correct path in the extension settings. Many features would be unavailable without access to PHP executable. Found Magento root at /Users/XXX/Sites/XXX/src

The 'Create a New Extension' makes fine for me but not the auto default content I get this message when creating any new file 'is not in the Magento 2 extension folder, not adding any template content' but it is in Magento2 Extension Folder.

i've set my php path to the php script I've created like @ljr95 which contains this

!/bin/bash

docker exec -it chemist-4-u-phpfpm-1 php $@

Thanks for you work :)

BillyBouman-2B-IT commented 2 weeks ago

Has anyone found a fix for this perhaps? I'm using Warden, no matter what I try, the output for MagentoWizard stays the same:

undefined
Looks like we don't have PHP executable available at '/Users/user/development/magento2/.vscode/php'. Please set correct path in the extension settings.
Many features would be unavailable without access to PHP executable.
Found Magento root at /Users/user/development/magento2

The undefined is coming from https://github.com/viperet/vscode-magento-wizard/blob/0b5c2b3ca967e80dbcff31461d3980f6df5aff1f/src/indexer.ts#L197 which should contain a helpful exception message, except it doesn't.