如何从wget运行PHP CLI命令?

如何从wget运行PHP CLI命令?,php,command-line-interface,wget,Php,Command Line Interface,Wget,我想从wget运行php cli命令,但它不起作用: run.sh文件: wget -t 1 --timeout=40 -e "php file.php" 错误: wget: Invalid command --execute "php file.php" 文件“file.php”和“run.sh”在同一个目录中。@arkascha这不是cron作业,同一目录中只有两个文件wget用于http链接执行而不是php,只需使用php file.php而不是wget-t1--timeout=40-

我想从wget运行php cli命令,但它不起作用:

run.sh文件:

wget -t 1 --timeout=40 -e "php file.php"
错误:

wget: Invalid command --execute "php file.php"

文件“file.php”和“run.sh”在同一个目录中。

@arkascha这不是cron作业,同一目录中只有两个文件wget用于http链接执行而不是php,只需使用
php file.php
而不是
wget-t1--timeout=40-e“php file.php”
,或者,如果您想执行wget,那么您必须传递链接,而不是wget`wget需要一个url。如果是在本地主机上,则可以。WEBget。我不认为您可以使用它运行cli,我也不理解您为什么要使用wget来实现这一点。wget中的-e选项不是任意执行命令。只要试试
wgethttp://localhost/path/file.php
的,如果已创建虚拟主机,则
wgethttp://virtual_host_name/path/file.php
是的,而且最重要的是:您只需使用
php file.php`即可使用cli版本的php执行sceipt。如果你喜欢,还有数千个脚本。