How to set up PHP executable path in VSCode (XAMPP user's)

3rchuss

Jesus Abril

Posted on January 11, 2020

How to set up PHP executable path in VSCode (XAMPP user's)

Did you find this message when creating a PHP file in VSCode?

Cannot validate since no PHP executable is set. Use the setting 'php.validate.executablePath' to configure the PHP executable.

1. First of all

Open settings.json and paste this line "php.validate.executablePath": "your_unit:/xampp/php/php.exe", paste this in the last line of your settings.json.
Ok, the annoying message does not pop up anymore, and now?.

That's all

not kidding really😄 but... we want to debug PHP also in VSCode right?.

2. CRTL+SHIFT+P

type ext install PHP Debug and install the first match.

Run XAMPP server, create a php file like test.php with phpinfo(); open it in your browser localhost/test.php copy the HTML source (what you see) and paste it into here: xdebug.org/wizard now hit analise my phpinfo() output.
Follow the instruction and download the .dll file, install it in the folder your_unit:\xampp\php\ext .

3. Almost done!

Now open you php.ini from XAMPP and paste the code in the very last line

[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
zend_extension = "you_unit:\xampp\php\ext\downloadedfile.dss

Save it!

Now, restart XAMPP and VSCode and you should be done!

Last thing

Wondering how it works?
Open your project on your browser, set a stop point in VSCode and see the magic!

You can follow the documentation at xdebug.org and also at VSCode extension page.

Thanks for read, it's my really first post

💖 💪 🙅 🚩
3rchuss
Jesus Abril

Posted on January 11, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related