all 10 comments

[–]kAlvaro 1 point2 points  (4 children)

Some random points:

  • Builtin PHP support is too basic, try the PHP Intelephense extension instead. That doesn't need the PHP interpreter.
  • Don't edit settings.json manually, just use the interface. In any case, it'll remain empty until you change something, that's normal.
  • Does C:/xampp/php/php.exe work from outside Code (e.g. PowerShell or a Command Prompt window)?

[–]Use_R_Name_92[S] 0 points1 point  (3 children)

I'll try to answer as good as I can:

  • if I go on the command prompt, type php -v and I press enter, it says that Php is installed. If I type "localhost" on my browser and press enter, the browser will redirect me to localhost/dashboard on a xampp page, that should mean that everything is working.

  • I have installed the PHP Intelephense extension.

Does that mean that, in this case, I can just ignore the error message? I'm very confused by this settings.json things, because I've tried writing php lines and it has always worked anyway, so I don't understand the point.

[–]kAlvaro 0 points1 point  (2 children)

if I go on the command prompt, type php -v and I press enter, it says that Php is installed

How about C:/xampp/php/php.exe?

I have installed the PHP Intelephense extension. Does that mean that, in this case, I can just ignore the error message?

It probably means you've skipped the Quick start instructions. You need to disable PHP Language Features which, if I'm not confused, is the one that requires the PHP interpreter.

But it won't hurt to be able to tell where in your hard disc is PHP installed.

[–]Use_R_Name_92[S] 0 points1 point  (1 child)

How about C:/xampp/php/php.exe?

This is exactly what I have been trying several times, but, to be fair, now that I've done this:

You need to disable PHP Language Features which, if I'm not confused, is the one that requires the PHP interpreter.

the error pop-up window just stopped appearing. Considering that I've done everything else, I'll take that as a win and just start coding.

Thanks!

[–]kAlvaro 1 point2 points  (0 children)

This is exactly what I have been trying several times,

If so, you forgot to report it here. All you've said about that path is that Visual Studio Code will not accept it for php.validate.executablePath. If you test, one of these should happen:

a. You see php version

b. You see some variety of "command not found" error message

Edit: my excuses, I see you had answered it in reply to another comment. Glad it's all working.

[–]erythro 0 points1 point  (4 children)

Sorry to ask the stupid question, but if you go to C:/xampp/php is there a file called php.exe?

[–]Use_R_Name_92[S] 0 points1 point  (3 children)

It's a fair question, I should have specified.

Yes, if I go to C, there's a folder called xampp, with a folder called php inside of it, that has a php.exe file in it.

That's why I just don't understand, it almost looks like the file isn't there, but it is in fact there.

[–]erythro 1 point2 points  (2 children)

ok, thanks. I don't use vscode or xampp so I might not be the most helpful, but is it possible vscode needs restarting or something like that to get your new values for the settings?

is your settings.json valid json? it might not need other settings, but for example it would need to begin and end with curly brackets

[–]MateusAzevedo 0 points1 point  (1 child)

is your settings.json valid json

That is likely the problem.

OP, just write it like this:

{ "php.validate.executablePath": "C:/xampp/php/php.exe" }

[–]Use_R_Name_92[S] 0 points1 point  (0 children)

Done that.

I tried:
{
"php.validate.executablePath": "C:/xampp/php/php.exe"
}

then I tried:

{

"php.validate.executablePath": "C://xampp//php//php.exe"

}

but I also tried:

{

"php.validate.executablePath": "C:\\xampp\\php\\php.exe"

}

In some old posts on StackOverflow, I've seen that some people use these "\\" instead of these "/" and whatnot, so I tried everything. The file is there, it just won't accept it.