http://www.perlmonks.org?node_id=1002706


in reply to Perl from PHP

koolgirl,
Rather than assume the problem is with PHP posting to a Perl CGI, first verify that you can run a Perl CGI directly. There could be a number of problems - the script doesn't have the correct ownership, permissions, isn't printing out headers, etc. If it were one of those issues - I would expect an error message rather than a white screen. More likely, something isn't working the way you expect and you are looking in the wrong broom closet.

Write the simplest hello world CGI you can. Verify it works directly. Replace the POST action to the hello world. Verify it works.

Cheers - L~R

Replies are listed 'Best First'.
Re^2: Perl from PHP
by fullermd (Priest) on Nov 07, 2012 at 21:05 UTC

    +1 to the above

    Remember, PHP doesn't have anything to do with POST'ing to your perl script. The user's browser posts to your perl script. And really, it doesn't even do that; it POST's to a URL. The browser doesn't know anything about PHP or perl, all it knows is that it has some HTML coming in one side, that tells it to send some HTTP stuff to this other URL.

    So your problem probably is either (a) the perl script not D'ingTRT as a CGI, or (b) the URL you're putting in not going to it. Or possibly a variant of both as (c) the server not being configured to run external CGI's, either where you put it, or anywhere.

    Luckily, they all have the same solution; forget the path you're currently taking to get there (the form), and the current contents of the script (whatever processing on the data). Just replace it with a bog-simple hello-world style script, and fiddle around until you can hit it directly and get the expected output. Then just dropping in the real code and the URL in the form will probably Just Work.