我想在 windows cmd 中运行一个 .php
文件.我跟着这个(建议)php 不被识别为内部命令(在 Windows 中)
I want to run a .php
file in windows cmd.
I followed this (suggestion)
php is not recognized as an internal command (in Windows)
但是没有用.
我试过这个命令提示符:
C:Windowssystem32>cd 我的文件夹
I tried this command prompt:
C:Windowssystem32> cd myfolder
在 myfolder
中,我做了如下操作:
<代码>C:..myfolder>php文件.php
但我收到错误消息php 未被识别为内部或外部"
And within myfolder
I did as follows:
C:..myfolder> php file.php
but I get an error "php is not recognized as internal or external"
但是当我尝试不使用这样的 php
命令时;
C:..myfolder>file.php
它只是在记事本中打开,但我想在 cmd
中运行它.
我该怎么做?
But when I try without php
command like this;
C:..myfolder> file.php
it just opens in notepad, yet I want to run it in cmd
.
How can I do it?
如果运行的是 Windows 10:
路径
如果在旧版 Windows 上:
显示桌面.
Show Desktop.
右键单击桌面上的我的电脑快捷方式.
Right Click My Computer shortcut in the desktop.
点击属性.
Click Properties.
您应该会看到控制面板的一部分 - 控制面板系统和安全系统.
You should see a section of control Panel - Control PanelSystem and SecuritySystem.
点击左侧菜单上的高级系统设置.
Click Advanced System Settings on the Left menu.
点击系统属性窗口底部的环境变量.
Click Enviornment Variables towards the bottom of the System Properties window.
在用户变量列表中选择PATH.
Select PATH in the user variables list.
将您的 PHP 路径 (C:myfolderphp) 附加到您的 PATH 变量中,用分号与现有字符串分隔.
Append your PHP Path (C:myfolderphp) to your PATH variable, separated from the already existing string by a semi colon.
点击确定
打开你的cmd"
输入PATH,按回车
确保您在列表中看到您的 PHP 文件夹.
Make sure that you see your PHP folder among the list.
应该可以.
注意:确保您的 PHP 文件夹中有 php.exe.它应该具有文件类型 CLI.如果您没有 php.exe,请继续检查安装指南 - http://www.php.net/manual/en/install.windows.manual.php - 并从那里下载安装文件.
Note: Make sure that your PHP folder has the php.exe. It should have the file type CLI. If you do not have the php.exe, go ahead and check the installation guidelines at - http://www.php.net/manual/en/install.windows.manual.php - and download the installation file from there.
这篇关于在 Windows 命令提示符 (cmd) 中运行 .php 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!