I have been battling this problem all day. The script itself is quite simple.

I am developing a web form that will allow the user to run an external program on the server. I am using Apache on win32, and using Perl via CGI.

At the command line, the script works perfectly. I am able to run the external program with no problems. However, when I hit submit and run the script via the web browser (POST), either nothing happens, or the external program crashes.

I have tried what I think is every technique in perl to run an external program.. system, exec, Win32::Spawn(), Win32::Process::Create(). They all work at the command prompt, but none work through the post method.

I am running under windows XP professional, and have set Everyone to have full control of the directory with the external program. The fact that it works via the command prompt and not the post method leads me to believe that there must be something different in the environment when perl is run through the post method.

Can someone enlighten me about what the difference is? And if you've had similar issues, and how you solved them..?


In reply to Calling external programs via cgi on win32 by jamesjyu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.