DEV Community

loading...

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

3rchuss profile image Jesus Abril ・2 min read

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 .
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

Discussion

pic
Editor guide
Collapse
jaimefo1 profile image
JAIME FERNANDEZ ORTEGA

Hola Jesús, me ha surgido un problema con VS Code, y es que ha dejado de maracar los bloques para colapsar, sólo en php, en js o html funciona, tienes idea de qué puede ser, he reinstalado, pero me coge los mismo settings, no cambia nada, el caso es que cuando lo inicio hay un momento al principio que aparecen las flechas de colapsar, pero se van en seguida, solo para php
un saludo :)

Collapse
3rchuss profile image
Jesus Abril Author

Hola Profe, pues creo que tienes un conflicto de plugins, prueba a deshabilitar los que no estés utilizando por el momento.

Collapse
amir_gharajedaghi profile image
Amir

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: go.microsoft.com/fwlink/?linkid=83...
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 80
}
]
}

Collapse
ntalamdotcom profile image
ntalam

it Works... thanks

Collapse
jreegene profile image
Jeremiah

ext install PHP Debug does not fetch anything to be installed. Any issues similar

Collapse
theonlywisdom profile image
Wisdom Akwoyere Baah

Perhaps you could try installing the PHP Debug extension, then take it from there.

Collapse
3rchuss profile image
Jesus Abril Author

Maybe incompatibility with other plug-ins.
Try to install the latest version and deactivate other php plug-ins.

Collapse
agbams profile image
Ugochukwu Agbams

Hey @3rchuss , thanks for this wonderful piece of work. It really helped me out, and I now have everything up and running with my vs code in connection with xampp.

Collapse
3rchuss profile image
Jesus Abril Author

Great. Im glad that this helped you out.
Thank you.

Collapse
jswizard profile image
Ogbuagu Francis

very helpful thanks

Collapse
harshitharas profile image
Harshitha Rasamsetty

What does "set a stop point in VSCode" mean?

Collapse
theonlywisdom profile image
Wisdom Akwoyere Baah

A break point, I guess.