0

There are similar topics about this, but everyone fails to answer the question. So to set up the php on visual studio code, using Linux Ubuntu 20.04, I have to set the exectubale Path. This should be:

"php.validate.executablePath": "/usr/bin/php"

Unfortunately Visual Studio Code keeps returning the error: "Cannot validate since /usr/bin/php is not a valid php executable. Use the setting 'php.validate.executablePath' to configure the PHP executable."

So, I also tried to dissable the @Builtin as stated by the PHP Intelehense. But than I continuously get the error 'PHP not found'. I tried setting the path in every possible parameter and I tried several paths, also invoking php.ini file direct (/etc/php/8.1/apache2), which also didn't make a difference.

I tried every possible path that "whereis php" returns. None of them is good for visual studio code. I tried reinstalling php, but it makes no sense cause ubuntu has a standard php inbuild. Neverthelles I am sure there is a php version running. I notice on the github page from brapifra that a lot of people have problems with this.

Why doesn't Visual Studio Code accept the correct path and how can I make it accept the correct path?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
User69
  • 39
  • 1
  • 7
  • please list the Q&A that you looked at. how am I supposed to know what you did or didn't look at? do I assume you looked at every single possibly related Q&A? Did you look at all of these? https://stackoverflow.com/q/55284737/11107541, https://stackoverflow.com/q/51518454/11107541, https://stackoverflow.com/q/64973675/11107541, https://stackoverflow.com/q/65950262/11107541 – starball Apr 27 '23 at 10:14
  • Did you disable the VS Code builtin PHP extension [like instructed](https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client)? see also: https://github.com/microsoft/vscode/issues/93244 – starball Apr 27 '23 at 10:15
  • Yes I looked at all of them, I've been going trough them since this morning but none of them really explains how to solve it. Yes I disabled @Builtin PHP extension. Than I only get NOT FOUND, so that doesn't solve it either. – User69 Apr 27 '23 at 10:33
  • It is working 'out-of-the-box' here (Ubuntu 22.04; VSCODE 1.77.3; PHP 8.1.2; Extension "PHP debug" ) "@builtin PHP" enabled or disabled does not have influence on working here – Luuk Apr 27 '23 at 16:21
  • "_Yes I disabled @Builtin PHP extension. Than I only get NOT FOUND, so that doesn't solve it either_" If you get an error my following the instructions, you should work to solve that error rather than trying to figure out how to do things in a way that the instructions specifically tell you not to do. Have you tried restarting VS Code between changes to `php.validate.executablePath`? Is there anything more to the error message in the output logs (View > Output > various output channels)? – starball Apr 27 '23 at 21:38

1 Answers1

0

The problem was in the Visual Studio Center from the Ubuntu Software Center, which had a problem setting the path correct. When I installed Visual Studio Code using the command line (sudo snap install --classic code), I only had to set the path "/usr/bin/php" as expected and it did work, even without having to disable @builtin php language features.

User69
  • 39
  • 1
  • 7
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 01 '23 at 07:06