![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| c system call | rangaswamy | High Level Programming | 1 | 02-19-2008 10:53 AM |
| lvm_queryvg call does not work properly and results in a sudden memory rise. | sandiworld | AIX | 0 | 11-14-2007 10:57 PM |
| pstat_getdisk() call doesn’t work properly in HPUX 11.31 (11i V3) | sandiworld | HP-UX | 2 | 10-25-2007 07:39 AM |
| how to differentiate system call from library call | muru | UNIX for Advanced & Expert Users | 2 | 07-19-2007 08:20 PM |
| does this variable call work--Korn | morkfard | UNIX for Dummies Questions & Answers | 2 | 07-10-2001 07:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
System call in CGI not work
I have a cgi script that calls a perl script (A.pl) to do something in backgroup, when run that perl script in command everything works fine, but when it calls by the CGI script, nothing works. I have tried another perl script (B.pl not cgi) calls A.pl, and it works fine.
The A.pl is chmod 777, Can someone here help? Thank you! Here is my cgi calling A.pl: #!/usr/bin/perl -w # use CGI; $mycgi = new CGI; print $mycgi->header; print $mycgi->start_html( -title=>'System Tes'', -BGCOLOR=>'#FFFFCC'); # do something here # system calls both don't work system("/mypath/A.pl"); unless (system("/mypath/A.pl")) { print "system calls failed: $!"; # not seeing this msg from browser } # print HTML message here, is seen from browser print $mycgi->end_html; exit; |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
What do you mean by "nothing works", do you get an error ? 5xx HTTP error perhaps? Has this ever worked? Are other cgi scripts working ok?
You should really never need to chmod 777 any script, especially a CGI script. add this to the top of your script. I suggest using this in all of your scripts. Code:
use strict; |
|
#3
|
|||
|
|||
|
If possible, you can rewrite your program to include code from A.pl
|
|
#4
|
|||
|
|||
|
Quote:
the print statement has to be wrapped as a line to html page, use "<br>" tags to see the error message in the html page What is the return code of system function call ? One more thing, make sure, it had happened several times, make sure of the absolute path of the filename |
|
#5
|
|||
|
|||
|
My cgi script is working fine. Paths in system calls are correct.
Here are my system calls from a cgi script: unless (system("/mypath/A.pl") == 0 ) { print "<br><br>1 system calls failed $?<br>"; } unless (system("/bin/cat /mypath/TMP.txt > /mypath/fileA.txt"") == 0) { print "<br><br>2 system calls failed $?<br>"; } unless (system("/bin/cp -f /mypath/fileA.txt /mypath/fileB.txt") == 0) { print "<br><br>3 system calls failed $?<br>"; } Return codes seen from browser: 1 system calls failed 3328 2 system calls failed 65280 3 system calls failed 256 |
|
#6
|
|||
|
|||
|
did you check the web server logs yet?
|
|
#7
|
|||
|
|||
|
I'm having the same problems, and I don't think I have access to the web server logs.
|
|||
| Google The UNIX and Linux Forums |