PHP IntelliSense on Fedora, executable not found

Issue

I have Visual Studio Code installed on Fedora V 36. Even though I’ve set the php executable in the setttings.json file I’m still getting

PHP executable not found. Install PHP 7.4.0 or higher and add it to your PATH or set the php.executablePath setting

settings.json

{
    "php.executablePath": "/usr/bin/php",
    "php.validate.executablePath": "/usr/bin/php",
}

whereis php shows

php: /usr/bin/php /usr/lib64/php /usr/share/php /usr/share/man/man1/php.1.gz

php -v shows

PHP 8.0.24 (cli) (built: Sep 28 2022 15:32:34) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.24, Copyright (c) Zend Technologies

The question is, how can I get VS Code, or rather IntelliSense, to recognize the php executable?

Solution

The answer was that VsCode was having a permission issue with the php executable, due to VsCode being installed from Flatpak.

After some trial and error I ended up uninstalling the Flatpak version of VsCode and re-installing with directions from the official site.

https://code.visualstudio.com/docs/setup/linux#_rhel-fedora-and-centos-based-distributions

Answered By – Rager

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published