問題描述
我想在 windows cmd 中運(yùn)行一個 .php
文件.我跟著這個(建議)php 不被識別為內(nèi)部命令(在 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 未被識別為內(nèi)部或外部"
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"
但是當(dāng)我嘗試不使用這樣的 php
命令時;
C:..myfolder>file.php
它只是在記事本中打開,但我想在 cmd
中運(yùn)行它.
我該怎么做?
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?
推薦答案
如果運(yùn)行的是 Windows 10:
- 打開開始菜單
- 輸入
路徑
- 點(diǎn)擊編輯系統(tǒng)環(huán)境變量(通常,它是搜索結(jié)果的頂部)并繼續(xù)下面的步驟6.
如果在舊版 Windows 上:
顯示桌面.
Show Desktop.
右鍵單擊桌面上的我的電腦快捷方式.
Right Click My Computer shortcut in the desktop.
點(diǎn)擊屬性.
Click Properties.
您應(yīng)該會看到控制面板的一部分 - 控制面板系統(tǒng)和安全系統(tǒng).
You should see a section of control Panel - Control PanelSystem and SecuritySystem.
點(diǎn)擊左側(cè)菜單上的高級系統(tǒng)設(shè)置.
Click Advanced System Settings on the Left menu.
點(diǎn)擊系統(tǒng)屬性窗口底部的環(huán)境變量.
Click Enviornment Variables towards the bottom of the System Properties window.
在用戶變量列表中選擇PATH.
Select PATH in the user variables list.
將您的 PHP 路徑 (C:myfolderphp) 附加到您的 PATH 變量中,用分號與現(xiàn)有字符串分隔.
Append your PHP Path (C:myfolderphp) to your PATH variable, separated from the already existing string by a semi colon.
點(diǎn)擊確定
打開你的cmd"
輸入PATH,按回車
確保您在列表中看到您的 PHP 文件夾.
Make sure that you see your PHP folder among the list.
應(yīng)該可以.
注意:確保您的 PHP 文件夾中有 php.exe.它應(yīng)該具有文件類型 CLI.如果您沒有 php.exe,請繼續(xù)檢查安裝指南 - 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.
這篇關(guān)于在 Windows 命令提示符 (cmd) 中運(yùn)行 .php 文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!