开发者

Creating a Self-Extracting Executable Using PHP

The self-extracting executable that I'm attempting to develop is an installer. An end-user will visit a site, then they will be prompted to register on the site and a download will be provided to them. That download is the self-extracting executable that will install the software on the end-user's computer along with a config file that will have the user's unique id in it. The software is a Windows Service so it will not be able to simply ask the user their username and password.

To be able to insert the registered user's unique id into the installer, I would have to generate the insta开发者_如何学运维ller on the fly. After researching and using my own experience, I decided that a self-extracting executable would be the best option. The question I have now is how can I generate one using PHP? After researching this problem, I found that the most common solution was to install a executable that could create self-extracting executables on the server machine and then invoke it from PHP. However, executing a executable is not possible with my web host, so this is not a viable solution.


However, executing a executable is not possible with my web host, so this is not a viable solution.

I think in that case, you will need to switch to a web host that lets you do this (or rent a dedicated or virtual server). You can create ZIP files from within PHP when the necessary libraries are installed, but that is about it. Producing Self-extracting executables is not on the menu.

If that is not an option, you would have to find a way to pre-produce the self-extracting executable and inject the user ID into it afterwards. That is surely possible, but I expect you would have to build a custom self-extractor for this.


A self-extracting archive is just an extractor with archive data appended. The extractor program opens itself, finds the offset of the data and extracts. There might be a trailer record to help find the offset.

You can append files easily in PHP: both an archive with your program and the user data. But you need to write a custom extractor that will be aware of this format.


I'm not sure this is possible.. The most you could do is use PHP to dynamically grab the files required surely?

Anyway, perhaps your application could access the internet to grab the files it needs periodically?

Or, you could reference an external PHP file in your program like /data.php?userid=1222&token=9999 which should be fairly secure.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜