Accessing PHP through the Command Line on Windows
Accessing PHP scripts via the command line (CLI) on Windows can prove challenging. This article addresses this issue and provides solutions to help you navigate this process effectively.
One common error encountered, as depicted in the provided image, is the "php.exe" command not being recognized. This occurs when the PHP installation directory is not added to the Windows %PATH% environment variable.
Solution: Adding to %PATH% Environment Variable
To add PHP to the %PATH% variable:
Alternative Approaches
If adding to the %PATH% variable is not preferred, you can also:
Once you have completed one of these steps, you should be able to execute PHP commands from the command line seamlessly.
The above is the detailed content of How to Make PHP Commands Work on the Windows Command Line?. For more information, please follow other related articles on the PHP Chinese website!