Fatal error: Only variables can be passed

Hi all, new to php but trying. I have a simple script that accepts a value from url then runs a perl script with parameters. When I test the script buy typing the following into browser
http://www.myserver.com/zcode.php?zipc=23919, I get the error in subject line. I contacted tech people who host server and was told the script had to be rewritten so not to open connections. At a loss on this. Any help would be appreciated.
The perl script produces an xml file. Below is the code

[php]<?php
$zipc="-Z";
$lineup="-Y USA";
$fformat="-U";
$duration="-d 2";
$outfile="-o";
$ofile=“guide.xml”;
exec(“perl http://www.myserver.com/myperl.pl”, array($zipc, $_GET[‘zipc’], $lineup, $fformat, $duration, $outfile, “http://www.myserver.com/guide.xml”));
print"FINALLY GOT TO END";
?>[/php]

The exec command is generally disabled on shared servers. It is not a good thing to allow for a variety of reasons actually. Is the goal to write an XML file? You can do that in PHP without using Perl.

If you have another purpose, you might be interested in this instead, passthru().

Or, just call the Perl script without using the exec command. Without testing, here is a routine that might
work for you. Not sure without a Perl script to test with it…

[php]
$perlscript_file = “http://www.myserver.com/myperl.pl $var1 $var2 $var3 $var4”;
$file = $perlscript_file . $var1 . $var2 .$var3 . $var4;
ob_start();
passthru($file);
$perlreturn = ob_get_contents();
ob_end_clean();
[/php]
Note that this is using the “passthru()” function. You should study that some first and alter the variables
or “arguments” to fit your uses… (This is just a simple example to get you started…)

Sponsor our Newsletter | Privacy Policy | Terms of Service