Hello folks, I have a script which makes a call to an external program:
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
`/usr/local/realproducer/realproducer ARGS...`;
print "Done\n";
When I run it from the shell it all works fine. But when I run it from CGI it doesn't run at all. There are no CGI errors, so it's not that.
Possibly there's an environment variables issue, and so I printed them from the script when run from the shell:
'HOME' = '/home/me';
'SSH_CLIENT' = 'IP ADDRESS 1027 22';
'SSH_CONNECTION' = 'IP ADDRESS 1027 IP ADDRESS 22';
'BLOCKSIZE' = 'K';
'EDITOR' = 'vi';
'MAIL' = '/var/mail/me';
'PWD' = '/tmp';
'USER' = 'me';
'LOGNAME' = 'me';
'SHLVL' = '1';
'OLDPWD' = '/home/me';
'ENV' = '/home/me/.shrc';
'_' = '/web/admin/media.pl';
'PATH' = '/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/us
+r/local/bi
n:/usr/X11R6/bin:/home/me/bin';
'SHELL' = '/usr/local/bin/bash';
'TERM' = 'vt100';
'PAGER' = 'more';
'SSH_TTY' = '/dev/ttyp0';
But nothing looks like it would cause problems, except for maybe the 'TERM' variable.
Another twist in the problem is that the "realproducer" program I am trying to run is a LINUX binary which I am running on FreeBSD in LINUX binary compatibility mode, perhaps it can't find the /compat/linux libraries? If this is the case does anyone know how I would tell PERL to look there?
Is it possible to have the CGI script create a user shell environment that the program could run in? What would that look like?
Thanks for any insights or directions anyone has, this is making me crazy...
Tosh
UPDATE: I've looked at all the easy things like permissions and if anything is actually running. It returns an ERROR 11 which seems to be "Resource deadlock avoided" whatever that means within the context. I've decided to cop-out and just have the progran run from CRON, I hope that will work... :(
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.