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

I am calling a perl script via the ACTION attribute of the FORM tag in an HTML page. If the script is on the same server as the web page that calls it, everything works beautifully. If the script is on a different machine, and I call it with something like

ACTION="http://192.168.201.165/somefolder/script.pl

the script will never be executed. Needless to say, IIE is configured the same on both machines.

Should the PERL script be on the same server as the HTML file calling it?

THanks

Replies are listed 'Best First'.
Re: Can't call PERL script on another server?
by Grygonos (Chaplain) on Aug 18, 2004 at 14:22 UTC

    No, the perl script does not have to be on the same server. I had a legit purpose for this once.. I needed to put a webpage up on one server that contained an online survey. That server would not give me rights for CGI scripts, so I redirected the form to a server that I did have CGI rights on, and ran the script there. Is that script on the other server readable globally? have you tried just pasting that url into the browser and seeing if you get something other than a 500 error?

Re: Can't call PERL script on another server?
by dragonchild (Archbishop) on Aug 18, 2004 at 14:31 UTC
    Do you have a webserver running on the second server with the script in the right place for CGI privileges?

    The beauty of HTTP(S) is that things can be anywhere and it will just work. Of course, every server needs to know how to handle HTTP(S) requests ....

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      Ok, let me give u a little more info that may shed some light onto the problem.

      Like I said before, the script is called to read in values from the form, process them, and write the results to a DAT file. The script also prints out a "Thank you for completing the survey" message to the browser. Now, when I click on the SUBMIT button of the form, I get the "thank you" message, which means that the script was successfully accessed on the other server.

      However, the DAT file which is supposed to hold the form's processed data is not written to. The strange thing is that the virtual directory that points to the cgi-bin (with the PERL script and the DAT file) has READ, WRITE and SCRIPT SOURCE ACCESS permissions, and it can also execute both scripts and executables. Everything seems to be in place and properly configured. So I'm not sure why this is happening... Thanks

        If you get the "thank you" message, then the CGI script is running. It just isn't doing what it is supposed to. You need to debug it; do all the standard debugging things. Look at error logs, check success of system calls, print out debug messages.

        The devil is in the details...are you trying to create the dat file on the external server? If so , the dat file will need to be written from the script on the external server. Have you checked the data you're passing the second script to make sure it's getting it? Write a simple script on the 2nd(external) server and simply write a file to the location that you are attempting to write to in the CGI script. If this works, then copy that algorithm into your script and see if your test file is written when you call the second script that displays "thank you". If it is, then there is something wrong with your initial file I/O used to create the DAT file. If not then you may have permissions issues related to the uid that the webserver is running under. Also, is the file being created on the external server with no content? or is it just not being created? If you are able to create the file and nothing is getting put in it... I would wager you aren't receiving the processed form data you are trying to write. I'm rambling because without any code we can only guesstimate your intentions.