1

I have PHP 8.1.4 installed on my PC on a C drive

but I have XAMPP in drive D which have all my PHP files and I have PHP 8.1.2 in XAMPP

I have PHP Intelephense installed on my VSCODE and I disable PHP Language Features

but still when I write PHP 8 or 8.1 syntax my vscode show error

enter image description here

1 Answers1

1

You have to specify your PHP version for the PHP intelephense extension.

2 ways to do that :

  • Settings > Preferences and typing "intelephense php version" and then yo can set 8.1.* instead 8.0.0 here :

  • edit your VSCODE settings.json with this : "intelephense.environment.phpVersion": "8.1.*".

NB : check if you have the lastest version of PHP Intelephense it also very important!

And that's it !

vinceAmstoutz
  • 676
  • 1
  • 4
  • 18
  • It is already set "intelephense.environment.phpVersion": "8.1.4", "php.executablePath": "D:/xampp/php/php.exe", "files.associations": { "*.module": "php" }, and i don't have paid PHP Intelephense i use free version – zack snyder Jun 24 '22 at 11:58
  • I have v1.8.2 of PHP Intelephense – zack snyder Jun 24 '22 at 12:00
  • It's very strange because it's works for me with PHP 8.1.7 and a free version. Have you already try to reinstall the extension ? Do you have any other settings related to PHP in your settings.json? What version of PHP Intelephense do you have (I have 1.8.2)? **Also update your VsCode to latest (important) !** – vinceAmstoutz Jun 24 '22 at 12:06
  • I have the latest version of vscode and PHP Intelephense – zack snyder Jun 24 '22 at 12:21
  • VSCODE version 1.68.1 and PHP Intelephense 1.8.2 – zack snyder Jun 24 '22 at 12:21
  • Mystery then ... Except uninstalling the extensions or the editor to start from scratch I personally don't see any solution, sorry :/ – vinceAmstoutz Jun 24 '22 at 12:25
  • I had installed a PHP extension which caused this error now the problem is solved – zack snyder Jun 25 '22 at 06:05