'php' not recognized as an internal or external command

Asked

Viewed 4,168 times

-1

inserir a descrição da imagem aqui

I’m facing this mistake when saving the file

  • 1

    Maybe you are using some kind of linter (checks code errors), many of them take Trigger when saved, and you don’t have PHP in your environment variables.

  • @Pliavi and how I change it?

  • Hm, for that you need to answer me 2 things (actually only the second, but to be able to give a more complete answer the first is a good one), which plugins do you use that are related to PHP? and where is the installation of your PHP (whether via XAMPP, WAMP, Direct, etc)

  • direct php usage, php plugins use only auto complete...

  • All right, which is the installation path? What is the name of the plugin and which editor is using?

  • php snipets, sublime usage 3, install path vc refers to php? pq I’m just quardando o the files on the machine, I run them on an external server, the strangest thing is that really from nothing began to give this error, a few minutes before the error I was without internet

  • I’ll see what’s wrong here, thanks for your help..

  • Oh yes, it’s not normal, I only know a "snippet" plugin that uses PHP (PHP-Intellisense Vscode), I just saw the configs of the one you talked about and it only uses what you type, without checking anything. Since PHP is not installed on your machine, you should still have some other plugin looking for it, go disabling one by one and saving, one time you should stop and you will find out what is causing the problem. And if you find the solution, do not hesitate to answer your own question.

Show 3 more comments

2 answers

1


Causative

According to the comments and the previous answer given by the questioner himself can be understood that the cause of the problem is a kind of linter that uses the executable php to check the problems within your code, most of them do this to remain consistent on any version of the motorcycle used, running its code, and capturing errors.

Problem

Like most of the Linters (and Syntax Chekers, Coding Standards Fixers, Style Checkers, etc) use some executable to make their tests, they need to be installed for them to work, as reported in the previous answer, the problem was caused by PHP Syntax Checker of Naomichi-y, and can be seen in line 6 of the Checker on Github that she uses a PHP command:

...
EXECUTE_COMMAND = "php -l"
...

This command is used to check errors in the code ONLY as can be seen in PHP manual:

-l Syntax check only (lint)

This command is only executed if the php executable exists on your computer and is mentioned in your environment variables.

How To Solve

There are 2 options:

  • Install PHP

    Oops: If even after installed the problem persists, make sure your environment variables are leading up to the folder containing the php.exe, if you don’t know how to do it, you can follow this step-by-step.
  • Remove the Plugin

    Oops: If even after removed the problem persists, check your plugins, must have some more that use php, are rare, but some autocompletes may also use.

0

cool head thinks better, I was with a plugin in sublime text 3 'PHP Syntax Checker' that had been installed a few days ago and did not remember. I removed it and the error nay reappeared.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.