Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PERL Apache Problem

Options
  • 30-08-2004 11:20pm
    #1
    Closed Accounts Posts: 1,541 ✭✭✭


    Hi.

    I have a problem executing a PERL script on my browser :( .

    The PERL script below is located in my CGI-bin:


    #!c:/Perl/bin/Perl.exe

    exec("c:/testtest.exe");

    print "Content-type: text/html\n\n";+

    rint "<h2>Your Program Executed!</h2>\n";


    testest.exe executes fine and is located on my C drive.
    The PERL script executes the program testtest.exe when I double click the PERL script in the CGI-bin. So everything seems to be fine. The testtest.exe works fine, the PERL program above works ok and executes the testtest.exe.
    Every other PERL script I have in the CGI-bin works fine when called from my browser. However when I try to execute the above PERL script by entering http://localhost/cgi-bin/exec.pl I get the "internal server error" problem and the testtest.exe program fails to execute. However if I remove the 2nd line Hello World is printed as expected.

    I am using apache on windows xp. The PERL program seems ok but Apache/XP will not allow me to execute it from any of my browser eventhough it allows me to execute other simple PERL scripts. Do I have to configure Apache to allow for exec use??? Any ideas on the problem??

    Thanks :) .

    The error log is below:
    [Mon Aug 30 23:13:31 2004] [error] [client 127.0.0.1] malformed header from script. Bad header=0: exec.pl


Comments

  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    Does testtest.exe print anything to stdout? You could try and move the exec to after the content-type line, so that at least a valid header is written out (regardless of the outcome of the exec command).

    .cg


  • Closed Accounts Posts: 304 ✭✭Zaltais


    cgarvey wrote:
    Does testtest.exe print anything to stdout? You could try and move the exec to after the content-type line, so that at least a valid header is written out (regardless of the outcome of the exec command).

    .cg

    Indeed, plus you could also try using 'system' instead of 'exec' to fork and return rather than just execute arbitrarily.


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    Thanks lads.

    The testtest.exe prints the numbers 0-9999 in a dos window one after the other, then exits.

    When I moved the 2nd line to after the "Hello World" part Hello world printed out on my HTML page as expected followed by the numbers from 0-9999 all on my HTML page. I did not write the testtest.exe program but whoever did must have used stdout or cout and I presume thats why the numbers were printed out on the HTNL page. I presume the program is executing ok now except the numbers appear on the HTML page instead of appearing in the DOS window.

    Thanks for your help guys, I think it did the trick. Sorry for asking about such basic mistakes! :D:D


Advertisement