Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a web-based program - running on Apache Server- that works fine and does some kind of online simulation . Now I am trying to transfer it on Windows 2000 server.

In this program, the user (client) "submit" some data through a html page in web which will run a cgi file on server. The cgi file put the submitted data in a txt file, and then calls an simulation.exe file which does some calculations on that data and make the output in another txt file and redirect to another html page which would contain the results of simulation. All the cgi processings and simulation executions are done on server and the client only sees the final results in the following page.

I came across with the problem of processing the cgi file in Windows. The cgi file is written in Perl. I saved both cgi file and that simulation.exe file in the same folder in wwwroot/inetpub/myfolder, but when I put adress http://localhost/myfolder/myfile.cgi in IE, it halts trying to run the cgi file, in spite of the fact that the related process (simulation.exe) is called ( as I checked in the "processor" tab.)

By the way, I have installed perl and set .cgi files to be opened by perl. The problem cant be with the syntax of the code since the cgi file can be run properly from the commandline using the perl command: perl myfile.cgi and the simulation is executed. But with IE, the problem arises. However, if I omit that simulation.exe commad line in cgi file, I can run the cgi file from IE without problem. So runnig the .exe file causes the problem. I did set the permissions (reading, writing,code executing) in Internet service manager.

My perl code:

#!c:/perl/bin/perl print "Content-type: text/html\n\n"; print"Hi!"; `simulation`;

Considered by trammell for readmore tags. Vote results (Keep/Edit/Delete): 9/11/3.
Unconsidered by davido: No vote consensus.
Janitored by davido: Added code tags and formatting to mirror OP's text entry format.

  • Comment on PLEASE HELP! How to make an exe file be executed on server through a cgi file?
  • Download Code

Replies are listed 'Best First'.
Re: PLEASE HELP! How to make an exe file be executed on server through a cgi file?
by diotalevi (Canon) on Dec 08, 2004 at 19:41 UTC
Re: PLEASE HELP! How to make an exe file be executed on server through a cgi file?
by ccn (Vicar) on Dec 08, 2004 at 19:44 UTC

    Try to specify the full path to your exe `c:/folder/simulation.exe`

      specifying the full path doesnt make it work.
Re: PLEASE HELP! How to make an exe file be executed on server through a cgi file?
by Anonymous Monk on Dec 09, 2004 at 07:31 UTC
Re: PLEASE HELP! How to make an exe file be executed on server through a cgi file?
by jonadab (Parson) on Dec 09, 2004 at 01:44 UTC
    What does your Apache error log say?
Re: PLEASE HELP! How to make an exe file be executed on server through a cgi file?
by ccn (Vicar) on Dec 10, 2004 at 10:36 UTC

    That may happen if the simulation.exe writes to STDERR not in STDOUT. You may try to redirect STDERR to STDOUT with a shell or use IPC::Open3