Jump to content

Running a perl script from php


pgrevents

Recommended Posts

actualy not solved here is the php code how do i now run and put the command through it?

 

<?php
//$poc = shell_exec("cd /../cgi-bin/net; ./excalc.pl php where=$_REQUEST[where]");

//$parms = explode("&",$poc);
//$command = $_SERVER[DOCUMENT_ROOT].'/public_html/get_iplayer/get_iplayer.pl --info > testinfo.txt';
  
  $var2 = 'get_iplayer/get_iplayer.pl';
  print $var2 ."<br />";
  $var3 = 'get_iplayer > test1.txt';
  $var4 = $var2 .",".$var3;
  if(virtual(`$var2, $var3`)){


print "<br /> <p style=\"font-size:24px; color:#900; text-align:center;\">If you see this the file has executed and passed the variable</p>";
}
else{
print "Error not executed";
}




?>

If you're trying to run a perl script then you simple need to call exec().

<?php
exec("perl file.pl");
?>

Assuming of course you're on Unix and perl can be called with the perl command.

 

it works on windows too..

 

just make sure the first line of your perl script is

#!C:\Perl64\bin\perl.exe -w  if you use perl from activestate.

or #!C:\strawberry\perl\bin\perl.exe -w if u use strawberry perl.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.