|
Posted by Justin Koivisto on 11/02/05 01:20
rickcasey wrote:
> I cannnot seem to get exec() or passthru() to execute a perl script;
> here's the code snippet:
>
> if ($debug) {
> echo "username1 = ".$username1."<br>";
> echo "dbname = ".$dbname."<br>";
> echo "SESSION[dbname] = ".$_SESSION['dbname']."<br>";
> echo "Output file = ".$outputfile."<br>";
> echo "Project name = ".$projectname."<br>";
> echo "Study name = ".$studyname."<br>";
> echo "The command to be run is: ".$cmd."<br>";
> }
>
> // Run the command!
> exec($cmd,$myoutput,$rtnvar);
> echo "rtnvar = ".$rtnvar."<br>";
>
> foreach ($myoutput as $line) {
> echo $line."<br>";
> }
>
> Which produces the results:
>
> username1 = rick
> dbname = cgb_lab_data
> SESSION[dbname] = cgb_lab_data
> Output file = myoutput
> Project name = IBS11_1103
> Study name = IBS 11
> The command to be run is: perl
> /home/caseyr/projects/LIMSScripts/3100DataIO/mk3100plt.pl -n 'IBS 11'
> -b 1103 -o myoutput -p IBS11_1103 -i S
> rtnvar = 13
>
> The command looks perfectly legit, and will run at the command line if
> I cut and paste it.
>
> I do not understand the return value of 13.
>
> I can get a simple perl script that takes no arguments to run ok; so I
> think this has something to do with the arguments. I've used
> escapeshellarg() to no avail. I've always tried the same with system()
> and the backtick operator -- nada!
>
> If anyone can spot what I might be doing wrong, I'd appreciate it!
First I'd try changing the single quote to double quotes: "IBS 11"
....as well as providing the full system path to the perl executable.
(run "which perl" to find it on the system).
You may also want to check that there aren't any extra control
characters like tab or newline in the command variable just in case...
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Navigation:
[Reply to this message]
|