PHP hangs when run from CMD

Issue

I have PHP added as an env variable – set to C:\Program Files\PHP\v7.3, but when I run php from CMD the window locks up and it just hangs indefinitely. When run "C:\Program Files\PHP\v7.3\php.exe" directly then the interactive shell starts normally.

No errors in the event log. Microsoft Visual C++ 2019 redistributable is installed. No other versions of PHP present (though there was an old version installed historically).

Solution

To run PHP in an interactive mode you need to pass the -a flag

example :

php -a or C:\Program Files\PHP\v7.3\php.exe -a

Running both php or C:\Program Files\PHP\v7.3\php.exe will cause the terminal to hang and a CLI php process to start

You can quit the process by pressing Ctrl + C

Answered By – lotfio

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published