vscode-php-intellisense icon indicating copy to clipboard operation
vscode-php-intellisense copied to clipboard

Extension fails to load PHP executable from PATH

Open christi-square opened this issue 2 years ago • 2 comments

When I open VSCode, this extension fails to load even though I have the PHP executable in my path. As a workaround, I can get the extension to load by setting "php.executablePath": "/usr/local/bin/php". It looks like the path is not being respected. Maybe this has something to do with the recent change to switch the default shell to zsh.

$ php -v
PHP 7.4.29 (cli) (built: Apr 14 2022 11:48:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.29, Copyright (c), by Zend Technologies
$ echo $PATH
[redacted]:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/share/dotnet:[redacted]
$ where php
/usr/local/bin/php

Screen Shot 2022-05-04 at 10 08 57 AM

christi-square avatar May 04 '22 14:05 christi-square

Hello

I've the same issue (exactly the same popup as yours) but ... on my side, I wish to be able to specify that the php.executablePath is a command like docker run -it --rm <my_image_name> php i.e. give the path to the executable inside my docker image.

Didn't find how to do this until now.

Also tried, without success: "php.executablePath": "${workspaceFolder}/.vscode/php.sh" and then, .vscode/php.sh is an executable script (and working fine i.e. i can run .vscode/php.sh --version f.i.).

So, on my side: how to specify the path so php is the one of my Docker image?

Thanks.

cavo789 avatar Dec 01 '22 10:12 cavo789

Damned, I've search two hours before posting and ... now I've found how : I'm working with WSL2 under Windows and Docker so just open my vscode editor and in the bottom left part of the screen, click on Reopen in container (this means you should have a .devcontainer/devcontainer.json file). Probably not a solution for you.

cavo789 avatar Dec 01 '22 10:12 cavo789