Cannot run PHP CLI on WAMP on Windows 8

若如初见. 提交于 2019-12-31 05:18:31

问题


I have been trying on this for hours i Get the below error

'php' is not recognized as an internal or external command, operable program or batch file.

Steps i have done 1- I have added to Windows Environement variables C:\wamp\bin\php\php5.3.13; 2-re-installed wamp 2 times 3-Apache and php error log is clean

I have the below configuration

  1. Windows 8 64 bit
  2. Apache 2.2
  3. PHP 5.3.13

回答1:


Actually the php exe you run in wamp for the CLI is just php.exe

It is found in the c\wamp\bin\php\phpX.Y.Z\ folder and called php.exe

Suggest you create a little batch file to setup the path so you can use it from anywhere by just keying php, like this:

phppath.cmd

set path=%PATH%;c:\wamp\bin\php\phpX.Y.Z
php -v

Store this batch file in a folder on your path and you are golden.




回答2:


You need to add php to your system path as follows:

  • go to system properties
  • chooose advance tab
  • check the system variables
  • choose Path then edit it and add at the end ;C:\xampp\php\

Note that system variables in Path are separated with ; same thing applies to WAMP all you need is to specify your php binaries folder




回答3:


seems that php-cli.exe dosent come along with WAMP, I installed XAMPP instead and CLI worked perfectly



来源:https://stackoverflow.com/questions/16166457/cannot-run-php-cli-on-wamp-on-windows-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!