How to set the env variable for PHP?

2020-01-25 01:00发布

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

标签: php windows wamp
7条回答
我欲成王,谁敢阻挡
2楼-- · 2020-01-25 01:24

You need to put the directory that has php.exe in you WAMP installation into your PATH. It is usually something like C:\wamp\xampp\php

查看更多
手持菜刀,她持情操
3楼-- · 2020-01-25 01:30

It depends on your OS, but if you are on Windows XP, you need to go to Systems Properties, then Advanced, then Environment Variables, and include the php binary path to the %PATH% variable.

Locate it by browsing your WAMP directory. It's called php.exe

查看更多
▲ chillily
4楼-- · 2020-01-25 01:34

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).

查看更多
成全新的幸福
5楼-- · 2020-01-25 01:39

Follow this for Windows operating system with WAMP installed.

System > Advanced System Settings > Environment Variables
Click new

Variable name  : path
Variable value : c:\wamp\bin\php\php5.3.13\


Click ok
查看更多
对你真心纯属浪费
6楼-- · 2020-01-25 01:43

Try display phpinfo() by file and check this var.

查看更多
小情绪 Triste *
7楼-- · 2020-01-25 01:44

You May use set keyword for set the path

set path=%path%;c:/wamp/bin/php/php5.3.0

if all the path are set in path variables

If you want to see all path list. you can use

set %path%

you need to append your php path behind this path.

This is how you can set environment variable.

查看更多
登录 后发表回答