D
D
DmitryLife2020-06-18 12:52:25
PHP
DmitryLife, 2020-06-18 12:52:25

Why doesn't PHP work on Open Server?

Good afternoon. I want to install Composer on a local server.

Installed Atom. Installed Terminal.

In Terminal I enter the installation commands for Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"


Error Response:
"php : The name 'php' is not recognized as the name of a cmdlet, function, script file, or executable. Please check the spelling of the name and the presence and correctness of the path, then try again."

As I understand it, the problem is that the program does not see PHP. But at the same time, PHP 7.1 is on the open server. I don't quite understand how this can happen.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hanneman, 2020-06-18
@DmitryLife

Because the path to php is not in the system path.
5eeb3abbea21c906549488.png
Environment Variables button -> select Path in the new window, press Edit and add the path to php. Open terminal again and try.
Or without all this, specify the full path to php.exe in the terminal every time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question