PHP exec() 函数 - 扩展后
感谢大家耐心回答我的问题“关于 PHP 中的 exec() 函数:关于 exec() PHP 中的函数”,它让我了解了它是如何工作的等等。他们中的很多人都指出了语法错误,请原谅我忘记加上引号。
实际上,我在正常情况下有一个要求,客户拥有 .exe 文件,他需要正常从命令提示符运行该文件,他需要手动包含许可证和配置文件的路径,以便应用程序对安装有效。
现在他想要一个 php 脚本,他将在其中输入带有有效登录详细信息的网页,并且通过单击链接,他应该能够运行 .exe 文件以在他的计算机上安装软件。包括许可证和配置文件是我一直在做的工作,另一方面,我仍然不清楚当脚本在 php 远程服务器上运行时,是否真的可以在客户端计算机上运行 .exe 文件。实现这一目标的其他替代方案是什么?有谁能解答我的疑惑吗?
thanks all of you for patiently answering my question "About exec() function in PHP: About exec() function in PHP", it has given me an idea of how this works and so. Lots of them pointed the syntax error, my pardon forgot to include the quotes.
Actually I have got a requirement in normal conditions the customer has the .exe file which he needs to normally run from command prompt, where he needs to include the path for the license and config files manually, so that application is valid for installation.
Now he wants a php script where he will enter the web page with his valid login details and with the click of link he should be able to run the .exe file to install the software on his machine. Including the license and config file is my job which I have been working on, on the other hand I am still not clear that this is really possible to run the .exe file on the clients machine when the script runs on the php remote server. What can be the other alternatives to accomplish this. Can anyone clear my doubts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您无法通过在服务器上运行的PHP脚本在客户端计算机上运行任何内容。这是不可能的。您可以做的是创建一个包含可执行文件、许可证文件和配置的存档(例如ZIP)。然后您可以将此存档提供给用户下载。在他的机器上提取存档后,他就可以执行该应用程序。
在客户端计算机上执行某些操作的其他可能性是 Java 小程序或 Flash 应用程序。但这些都受到很多安全限制。
You cannot run anything on the client machine from a PHP script running on the server. It's impossible. What you can do is create an archive (e.g. ZIP) that contains the executable file, the license file and the configuration. Then you can offer this archive to the user as download. After extracting the archive on his machine he then would be able to execute the application.
Other possibilities to execute something on the client machine would be a Java applet or a Flash application. Those are subject to a lot of security restrictions though.
替代方案:
1.将设置保存到文件
2.压缩程序以与设置文件一起存档&&许可证
3.下载存档
Alternative:
1.Save settings to file
2.Compact programm to archive with setting file && license
3.Download archive
PHP在服务器上,服务器生成HTML/JS/CSS。 PHP 进程在网页显示给用户之前结束。
没有办法,而且有一个非常非常充分的理由为什么这不能或永远无法做到。
除了恶意原因之外,为什么要在某人的计算机上运行 .exe 文件呢?
您在网络上出售订阅,您在谈论什么许可?
PHP is on the server, the server generates HTML/JS/CSS. The PHP process ends before the web page is displayed to the user.
There's no way, and a VERY VERY good reason why this can not or will never be able to be done.
And why would you want to run an .exe file on someone's computer other than malicious reasons?
You're on the Web, sell subscription, what licensing are you talking about?
无法直接从 PHP 在客户端计算机上实际执行程序。您希望实现的最好结果是提供可执行文件的下载,然后客户端可以手动执行它。您可以提供带有安装可执行文件和配置/许可证文件的存档文件,但客户端仍然需要手动执行该文件。
您可以使用 Flash、Java 或 ActiveX 等客户端技术来完成此任务,但这不是一项简单的任务,需要对这些技术所基于的语言有相当深入的了解。
如果该文件是 MSI,理论上可以允许服务器将其远程安装到客户端计算机上,但是这存在一些障碍:
There is no way to actually execute a program on the client machine directly from PHP. The best you can hope to achieve is to provide a download for the executable file and then the client can execute it manually. You could provide an archive file with the installation executable and config/license file(s), but the client would still have to execute the file manually.
You could potentially use client-side technologies such as Flash, Java or ActiveX to accomplish this, but this is not a simple task and requires fairly intimate knowledge of the languages on which these technologies are based.
If the file was an MSI, it would be theoretically possible to allow the server to remotely install it on the client machine, however there are some barriers to this: