VS Code doesn't connect to php

I am using a Mac. Following the install instructions you only need to

  1. install Local
  2. Install Xdebug-Addon
  3. Install VS Code
  4. Install xdebug extension to VSCode

If I am right, php and Xdebug should be already installed by installing 2 and 3.

When trying to debug, VS Code says: PHP executable not found. Install PHP and add it to your PATH or set the php.debug.executablePath setting

Should I add an executablePath to the settings.json? And if yes, where do I find it?

I know that the question is already asked. But I didn’t find any working answer. Especially because the most threads relates to php 7.x. Would great to get help on that.

Hey @Guenter!

What is your MacOS version?

Are you using the latest release of Local?

Could you also share a copy of your Local Log here? Retrieving Local’s Log File

The problem is that Local doesn’t add PHP to your system path, and it doesn’t seem that clicking VSCode inside Local sets that either.

If you go to Local and click Site Shell it will set up all your paths, and then “vscode .” from there will work. Note this also configures mysql and wp-cli, which can be useful.

Alternatively check that shell’s path for the PHP location and add it to executablePath.

Personally I have a script to do all this, and it calls the Local script which sets the paths and then opens VSCode. The Local script will be in in …\Local\ssh-entry - not sure where that is on Mac, but you should be able to figure it out from the Site Shell. You can get the 8 character script name by checking MYSQL_HOME variable, it should be pretty obvious.

1 Like

Hi Nick,

thank you for your reply.

My MacOS Version is 14.5 (23F79).

I have installed Local Version Version 9.1.0+6719

Here is the log-Zip
local-logs.zip (26.2 KB)

Best
GĂĽnter

Hi Dave,

the Click on the Side Shell didn’t lead to any reaction in the past. That could be a relevant part of the project. I reinstalled local several times, but I saw no effect. I’ve tried it again, and the err is reflected in the log-file

local-lightning-verbose0.log (275.1 KB)

Unfortunately, I am a tech-newbie. I am imagining that you create some kind of a docker-like container and for that I need this extra site shell, right? Is there any other way to get to this shell?

Best
GĂĽnter

The bug is usually sitting on the other side of the screen.

I’ve installed LocalWP on another computer (much slower). Everything works smoothly there (apart from the speed).

When starting LocalWP I was asked to allow LocalWP to interact with the terminal.

When I remember well I didn’t allow that when first installing LocalWP (don’t know, why). But now I find no way to undo this and grant the permission. Can you help me on that?

with the help from chatgpt I found a solution to reset the permission question. I have given the permission and now everything works well. Sorry, for bothering you with that question and thank you for your help. The hint about the Shell was decisive. We may close this thread here. Best GĂĽnter

1 Like

Apologies @Guenter I’ve just circled back here but I’m glad to hear you were able to find what you needed! If you have any other questions or concerns don’t hesitate to reach back out. We are always happy to help!