You need to add your PHP installation directory to the %PATH%
environment variable, or work from the PHP installation directory.
To add it to path (The best approach - Edited for Windows 7):
- Right-click on a
My Computer
icon
- Click
Properties
- Click
Advanced system settings
from the left nav
- Click
Advanced
tab
- Click
Environment Variables
button
- In the
System Variables
section, select Path
(case-insensitive) and click Edit
button
- Add a semi-colon (
;
) to the end of the string, then add the full file system path of your PHP installation (e.g. C:Program FilesPHP
)
- Keep clicking
OK
etc until all dialog boxes have disappeared
- Close your command prompt and open it again
- Sorted
Alternatively, you can run cd <PHP installation path>
before you try and run you command, or call your script like <FULL file system path of php.exe> <path to script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…