在Windows CMD中运行php文件 [英] Run php file in windows CMD

查看:249
本文介绍了在Windows CMD中运行php文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows cmd中运行.php文件。
i遵循这个建议:
php不被识别为实习命令(使用窗口)



但不工作。



我试图在命令程序C:\Windows \system32\cd \myfolder
然后它进入我的文件夹像C: \ php
但是当我输入我的php文件地址像C:\myfolder\php file.php
它只是显示错误php不能识别为内部或外部
但是当我尝试没有php命令像C:\myfolder\file.php它只是在记事本中打开。
但是我想在CMD中运行它。怎么可能呢?

解决方案


  1. 显示桌面。


  2. 右键点击桌面上的 我的计算机快捷方式。



  3. 您应该会看到控制面板的一部分 -


  4. 点击高级系统设置


  5. 点击窗口底部的 环境变量 / p>


  6. 在用户变量列表中选择 PATH

    将您的PHP路径(C:\myfolder\php)附加到您的PATH变量,通过分号与现有字符串分隔。


  7. 点击确定


  8. 打开您的cmd


  9. 确保您在列表中看到您的PHP文件夹。


这应该可以工作。



注意:确保你的PHP文件夹有php.exe。它应该具有文件类型CLI。如果您没有php.exe,请继续并查看安装指南,网址为 - http:/ /www.php.net/manual/en/install.windows.manual.php - 并从那里下载安装文件。


I wanna run a .php file in windows cmd. i have follow this suggestion : php is not recognized as an intern command (using windows)

But not working.

I am trying to do in command program C:\Windows\system32\cd \myfolder Then it enter in my folder like C:\php but when i enter my my php file address like C:\myfolder\php file.php it just showing error "php is not recognized as internal or external" But when i try without php command like C:\myfolder\file.php it just open in notepad. But i wanna run it in CMD. How can be it possible ?

解决方案

  1. Show Desktop.

  2. Right Click My Computer shortcut in the desktop.

  3. Click Properties.

  4. You should see a section of control Panel - Control Panel\System and Security\System.

  5. Click Advanced System Settings on the Left menu.

  6. Click Enviornment Variables towards the bottom of the window.

  7. Select PATH in the user variables list.

  8. Append your PHP Path (C:\myfolder\php) to your PATH variable, separated from the already existing string by a semi colon.

  9. Click OK

  10. Open your "cmd"

  11. Type PATH, press enter

  12. Make sure that you see your PHP folder among the list.

That should work.

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文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆