I
I
Issue2022-04-18 19:00:45
PHP
Issue, 2022-04-18 19:00:45

How to run php.exe from windows console?

No matter how I tried to write .bat, I can’t figure out how to run php even in a simple Windows console.
625d8b2793818477044019.png
In Linux, everything is simple: I launch the terminal in the folder and write ./php -v
everything works. Windows is complete trash. Please tell me how to run php using .bat file

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
yazhog, 2022-04-18
@paulenot

Apparently you have a broken php.
just downloaded and run:
625dd04f3bbe8153602812.png
alternatively try Bamcompile , it will turn your .php script into an executable .exe file

A
Anton Shamanov, 2022-04-18
@SilenceOfWinter

the path to php.exe must be added to the PATH
batch file:

@echo off
@setlocal
set SCRIPT_PATH=%~dp0
php.exe --f "%SCRIPT_PATH%script.php" %*
@endlocal

if php.exe is not specified in PATH, then in the batch file you specify the absolute path to php.exe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question