简体   繁体   English

如何使用命令行启动 PHP 文件

[英]How do I launch a PHP file using command line

Specifically I'm looking at Symphony and I'm running through this page.具体来说,我正在查看 Symphony,并且正在浏览页面。 It suggests that I launch a file using command line.它建议我使用命令行启动一个文件。

OS: Windows Visa 32操作系统: Windows 签证 32

Any help?有什么帮助吗?

Open a command line, and type打开命令行,输入

php check_configuration.php

(Press Enter after that). (之后按 Enter 键)。

If you're trying to execute php on Windows, you need to set up your PATH variable to include the php binary directory beforehand.如果您尝试在 Windows 上执行 php,则需要预先设置 PATH 变量以包含 php 二进制目录。

If you're on a POSIX-compatible system (Linux/Mac OS X) and you're getting a "command not found error message", you need to install php and its CLI interface, often in a package php-cli or similar.如果您使用的是 POSIX 兼容系统 (Linux/Mac OS X) 并且收到“找不到命令错误消息”,则需要安装 php 及其 CLI 界面,通常在 package php-cli或类似文件中.

Generally, you should be able to do php -f somefile.php .一般来说,你应该能够做到php -f somefile.php See the PHP command line manual for more info.有关详细信息,请参阅PHP 命令行手册 The link you gave also shows what to do.您提供的链接还显示了该怎么做。

Do exactly what it says on that page:完全按照该页面上的说明进行操作:

php server_check.php

Assuming you are in the dir containing servercheck.php.假设您在包含 servercheck.php 的目录中。

Most of the other symfony commands actually use a single file you can invoke those with大多数其他 symfony 命令实际上使用单个文件,您可以调用这些文件

symfony namespace:task [options] [arguments]

or或者

php symfony namespace:task [options] [arguments]

When it says to run that file, basically its the same as pasting that file to the directory of symphony's php config files, and then running it in your browser.当它说运行该文件时,基本上与将该文件粘贴到 symphony 的 php 配置文件的目录中,然后在浏览器中运行它相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM