简体   繁体   English

在Linux apache中像CGI一样运行EXE文件

[英]Running EXE files in linux apache like a CGI

I have an old system which connects to my custom hardware that I will be delivering simple HTML out of. 我有一个旧系统,该系统连接到我的自定义硬件,我将提供简单的HTML。

If I wanted to waste electricity, I'd have two computers constantly running and then I can test my pages on the fly. 如果我想浪费电能,我会一直运行两台计算机,然后就可以即时测试页面。

Instead, I want to do all my work on one computer my linux system. 相反,我想在linux系统的一台计算机上完成所有工作。

Currently I can serve CGI pages through Apache in Linux and those are compiled C programs. 目前,我可以通过Linux中的Apache服务CGI页面,这些页面是经过编译的C程序。

But because the target computer has Quick Basic and I compile EXE files through that language, I can do the same on my linux computer through DOSBOX. 但是由于目标计算机具有Quick Basic,并且我可以通过该语言编译EXE文件,因此我可以通过DOSBOX在Linux计算机上执行相同的操作。

The nice news is I can execute my Quick Basic program on a unix commandline via the linux WineConsole command and the output prints correctly despite the warning messages printed to stderr. 好消息是我可以通过linux WineConsole命令在unix命令行上执行我的Quick Basic程序,尽管警告消息已打印到stderr,但输出仍可以正确打印。

The sad news is I can't find a way to load my EXE as if it was part of a URL in a browser and have the same contents shown in the browser itself as what I saw on the commandline. 不幸的消息是,我找不到一种加载EXE的方式,就好像它是浏览器中URL的一部分一样,并且在浏览器中显示的内容与在命令行中看到的内容相同。

My only guess is to find a specialized apache module that can allow me to associate extensions with programs but I don't know of such a module. 我唯一的猜测是找到一个专用的Apache模块,该模块可以使我将扩展程序与程序相关联,但是我不知道这样的模块。

Is there another way one can run an EXE file in linux apache and have the standard output contents dumped to the screen? 还有另一种方法可以在linux apache中运行EXE文件并将标准输出内容转储到屏幕上吗?

Have you tried using dosemu instead of dosbox? 您是否尝试过使用Dosemu代替dosbox?

If dosemu is able to output to stdout, you can wrap it inside a shell script that will be your CGI 如果dosemu能够输出到stdout,则可以将其包装在将成为您的CGI的shell脚本中

If you aren't using DOS specific routines in your basic code, you might be better of compiling it as a linux executable using a basic compiler for linux. 如果您在基本代码中未使用DOS特定的例程,则最好使用Linux的基本编译器将其编译为linux可执行文件。

You might want to look into this. 您可能需要调查一下。 I know there is a compiler called FreeBasic which should be able to compile QuickBasic code to a linux executable. 我知道有一个名为FreeBasic的编译器,它应该能够将QuickBasic代码编译为linux可执行文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM