4

One of our engineers facing an error with PhpStorm. Whenever he edits anything in PhpStorm, it gives the error related to PHP_Codesniffer:

phpcs: env: php: No such file or directory...

If open PHPCodeSniffer Inspection Settings, the below attached settings can be seen.

Please click here to see the settings

One more point, it was working fine until he upgrades his MacOS from Big Sur to Monterey 12.0.1. Not sure this OS upgrade affect the application settings. Presently he cannot work with PhpStorm.

Could you please have a look and let me know?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Joseph
  • 41
  • 1
  • 2
  • 1
    *"phpcs: env: php: No such file or directory..."* phpcs uses your **OS-level / system-wide PHP executable**. Looks like it you do not have anything for `php`. Type `which php` (or is it `where php` ?) and see if it will show any results. – LazyOne Dec 18 '21 at 16:33
  • @LazyOne: `% where which` produces: `which: shell built-in command` and `/usr/bin/which`..... But to add to this, you could also do `whereis php` – Luuk Dec 18 '21 at 16:38
  • @Luuk I'm Windows user. Here in **cmd** shell that would be `where php`. On Linux that should be `which php`. What is the right command on Mac -- sadly I do not know... But I would assume that `which php` would work (P.S. never seen `whereis` command before) – LazyOne Dec 18 '21 at 16:43
  • @LazyOne: all 3 variants (where/which/whereis) work in my Mac. – Luuk Dec 18 '21 at 16:44
  • @joseph: did you check [Install and configure PHP CS Fixer](https://www.jetbrains.com/help/phpstorm/using-php-cs-fixer.html#installing-configuring-php-cs-fixer) ? – Luuk Dec 18 '21 at 16:50
  • Thanks friends. Let me check. Will revert you. – Joseph Dec 20 '21 at 08:16

1 Answers1

3

One more point, it was working fine until he upgrades his MacOS from Big Sur to Monterey 12.0.1. Not sure this OS upgrade affect the application settings. Presently he cannot work with PhpStorm.

I had the same issue. Monterey removes the installed PHP version, as Mac OS no longer ships with php installed. Install php and it should work again.

In my case, using homebrew

brew install php@7.4
brew link php@7.4
DragoonKmesh
  • 74
  • 1
  • 7
  • In my case, relinking `php` using the following brew command and restarting my IDE (PhpStorm) has fixed it: `brew unlink php && brew link php` – Sivaram Koduri Oct 31 '22 at 19:04