How to set the env variable for PHP?

后端 未结 7 1998
梦如初夏
梦如初夏 2020-11-27 18:56

I am using WAMP. I want to use php from the command prompt. What is the entry in PATH env variable for this ?

7条回答
  •  离开以前
    2020-11-27 19:31

    You need to add the PHP directory to your path. On the command line (e.g. in a batch file), it would look like this:

    SET PATH=%PATH%;C:\your\wamp\path\php
    

    if in doubt, it's the directory containing the php.exe.

    You can also pre-set the path in Windows' control panel. See here on how to do this in Windows 7 for example.

    Be aware that if you call the PHP executable from an arbitrary directory, that directory will be the working directory. You may need to adjust your scripts so they use the proper directories for their file operations (if there are any).

提交回复
热议问题