从 PHP 文件发送脚本
有谁知道是否可以将命令行脚本从 php 页面发送到没有 php 文件的另一台服务器?因此,Php 文件位于服务器 A 上,而命令行脚本需要在服务器 B 上运行。两者都在本地托管,但位于不同的计算机上。
我认为这是不可能的,但只是想看看是否有其他人尝试过或知道它也不起作用。
谢谢, 麦克风
Does anyone know if it is possible to send a command line script from a php page to another server from which the php file is not on? So Php file is on server A and the command line script needs to be run on server B. Both are hosted locally but on seperate machines.
I dont think it is possible but just want to see if anyone else has tried it or knows it doesnt work either.
Thanks,
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以使 PHP 脚本使用 SSH 登录到另一台服务器,但这非常复杂。
在远程服务器上拥有一个可公开访问的 PHP 文件、通过 Web 调用该文件并让它执行您需要的任何操作可能要容易得多。
It is possible to make a PHP script log on to another server using SSH, but it's very complicated.
It's probably much, much easier to have a publicly accessible PHP file on the remote server, call that through the web, and have it perform whatever actions you need.
您所描述的内容可以作为 Pekka 所描述的简单的“REST 服务”来完成。
您还应该研究“RPC”(远程过程调用)和“SOAP”。
这两者都带有一些包袱,而且都可能有些过分,但它们都是问题的解决方案。
What you describe can be done as a a simple "REST service" which Pekka described.
You should also research "RPC" (Remote Procedure Call) and "SOAP" as well.
Both of those come with some baggage, and both are probably overkill, but they are solutions to the problem.