vscode-phpserver icon indicating copy to clipboard operation
vscode-phpserver copied to clipboard

php not found

Open AnuragRai017 opened this issue 3 years ago • 11 comments

Issue Type: Feature Request

php not found

Extension version: 3.0.2 VS Code version: Code 1.56.2 (054a9295330880ed74ceaedda236253b4f39a335, 2021-05-12T17:13:13.157Z) OS version: Windows_NT x64 10.0.19042

AnuragRai017 avatar Jun 05 '21 04:06 AnuragRai017

I had the same problem. Try pressing Ctrl+, to open your settings, then search for phpserver.phpPath and put in the path of your php executable. Can't remember if I had to reload VS Code after.

image

KGrafton86 avatar Jun 12 '21 22:06 KGrafton86

Having the same exact issue. I can confirm that my php.exe is working due to other extensions using it (and version checking it multiple times). I changed my settings.json file to include all of this just to be super sure:

"php.validate.executablePath": "C:\xampp\php\php.exe", "php.executablePath": "C:\xampp\php\php.exe", "phpserver.phpPath": "C:\xampp\php\php.exe",

I tried making them all the surrounding folder rather than the .exe itself, enabled and disabled all builtin PHP functionality in VSCode, and still nothing. No matter how many times I restart or change things I can't get the server to recognize php.exe. I even installed PHP separately and tried using that .exe instead with no luck. Any ideas?

sm967 avatar Jun 18 '21 20:06 sm967

The backslashes need to be escaped in the json file. Does your file look like the first line in this image or the second line?

image

If I don't have the backslashes escaped, parts of the string show in different colors, but when I add the escape characters, it all changes to one color (I'm using the Dark+ (default dark) theme, strings in json show as orange). If yours looks like the top line, try adding the escape characters and see if it helps. It is possible that you've set up a different escape character for json, but \ is the default.

KGrafton86 avatar Jun 19 '21 02:06 KGrafton86

I have had the characters escaped in my settings.json file since I started troubleshooting, still gives me the same error message every time. Any other ideas as to what I could be doing wrong?

image

sm967 avatar Jun 22 '21 15:06 sm967

PHP not found.
I have tried just about every possible setting as well. I hope the author is viewing these comments.

AlexanderAdelAU avatar Feb 18 '22 00:02 AlexanderAdelAU

i have this issue now, it worked before but now it says php not found?

ThnksCJ avatar Mar 12 '22 15:03 ThnksCJ

Did anyone manage to solve this? I have the same problem with Ubuntu.

Muschke avatar Apr 27 '23 13:04 Muschke

Running this command in the terminal worked for me (Ubuntu user) sudo apt-get install php

chachathecool avatar Apr 30 '23 14:04 chachathecool

Ofcourse php needs to be installed. I solved the issue by installing visual studio using the command line, instead of via the software center. I could set the path "/usr/bin/php" correct without having to disable the PHP features app.

Muschke avatar May 02 '23 10:05 Muschke

Hello everyone, I had the same issue and the problem was that I specified the path in settings.json within the code runner extension and not for the whole vscode. Check to see if you accidentally wrote it in the wrong place too изображение_2023-05-20_153428251

Guulik avatar May 20 '23 12:05 Guulik

required Visual Studio C++ for PHP [Visual Studio C++]

https://learn.microsoft.com/pt-br/cpp/windows/latest-supported-vc-redist?view=msvc-170

x64 https://aka.ms/vs/17/release/vc_redist.x64.exe

ProjetoIACrigma avatar Oct 25 '23 05:10 ProjetoIACrigma