Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP not found in VS Code

I'm trying to learn PHP and am encountering some issues early on. When I setup my basic file, then select PHP serve project, I receive a message at the bottom right of the screen saying PHP not found. I've setup my settings for the default xampp php file folder location with the command: "php.validate.executablePath": "c:\xampp\php\php.exe",

Pics are attached. Any help would be really appreciated.

JSON Settings

Basic PHP File

like image 275
Ryan C Avatar asked Jul 09 '26 15:07

Ryan C


2 Answers

Go to the PHP Server extension setting. There you have to add the path for:

PHP Config Path: C:\xampp\php\php.ini

PHP Path: C:\xampp\php\php.exe

[Make sure to add your installed folder, if you have installed xampp in another drive, you need to give that specific location.]

My settings:

My settings screenshot here

like image 111
khalilonline99 Avatar answered Jul 13 '26 14:07

khalilonline99


Go to File->Preferences->settings->User settings tab->extensions->from the drop down select php->on the right pane under PHP › Validate: Executable Path select edit in settings.json.

Then set the path as your case may be for a XAMPP user who installed XAMPP on c drive you will have:

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

If PHP is installed in your system independently or by other means simply set the path of your php.exe file like below:

"php.validate.executablePath": "C://path.to.your.php.folder//php.exe"

Found this solution from php not found visual studio.

like image 40
Meher Ullah Khan Raj Avatar answered Jul 13 '26 14:07

Meher Ullah Khan Raj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!