从多台计算机运行 PHP 脚本?
我写了一个 PHP 脚本,我在本地 PC 上的 MS-DOS 上运行这样的代码:
C:\wamp\bin\php\php5.3.0\php.exe index.php
现在我想在网络上上传 index.php,但在多台计算机上(没有安装 PHP/Apache),我该如何运行通过网络在 ms-dos 上使用index.php?
如果不可能,我可以在每台计算机上打开多个putty应用程序并登录ssh吗?
index.php 将继续循环 - 在浏览器上运行脚本并不好,因为它可能会导致浏览器超时。
I have written a PHP Script, I run the code like this on MS-DOS on my local PC:
C:\wamp\bin\php\php5.3.0\php.exe index.php
Now I want to upload the index.php on the web but on multiple computers (without PHP/Apache installed), how can I run index.php on ms-dos via web?
If that not possible, I can open multiple putty application on each computer and login ssh?
index.php will continues looping - it wont be good to run script on the browser because it may cause timeout via browser.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你不能。如果您在每台计算机上使用 putty 登录另一台计算机来运行脚本,则该脚本仍将在“另一台”计算机上运行。您所做的就是使其输出显示在运行 putty 的本地计算机上。这与在服务器上打开多个 shell 并在每个窗口中运行脚本完全相同。
如果您希望 PHP 脚本“本地”运行,则需要在每台将运行该脚本的计算机上本地安装 PHP。就像我在其他类似问题中所说的那样,有些 PHP 编译器可以生成可能可移植的 .exe,但不能保证它可以工作。 PHP可以编译,但并非所有脚本都可以编译。
You can't. If you're using putty on each computer to log into another machine to run the script, the script will still be running on "the other" machine. All you've done is make its output appear on the local computer that's running putty. It'd be exactly the same as opening multiple shells on the server and running the script in each window.
If you want a PHP script to run "locally", then you need PHP installed locally on each machine that will run the script. And like I said in your other similar question, there are PHP compilers which can produce a .exe that MIGHT be portable, but it's not guaranteed to work. PHP can be compiled, but not all scripts are compileable.
查看 bamcompile。
它允许您将 PHP 文件编译为 exe。
并非一切都有效,但值得一试:http://www.bambalam.se/bamcompile/
我认为它使用 PHP 4.something 所以不知道它是否适用于你的脚本没有看到它
编辑
你说你担心如果在浏览器中运行超时。
该脚本有什么作用?
也许 PHP 不是您的最佳选择。
Check out bamcompile.
It lets you compile the PHP file to an exe.
Not everything works but it is worth the shot: http://www.bambalam.se/bamcompile/
I think it uses PHP 4.something so don't know wether it works for your script without seeing it
EDIT
You said you are worried about an timeout if ran in browser.
What does the script do?
Perhaps PHP isn't you're best option.
最简单的方法是在这些计算机上安装 Apache 和 PHP,然后在该计算机上显示一个为您运行命令的脚本。
这样,您就可以开始运行脚本,而不会导致 Apache 端的脚本超时。
The easiest way would be to have Apache and PHP installed on those computers, and then have a script visible on that computers that runs the command for you.
This way, you can start running the script without having the script time out from Apache's end.