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";
}




?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.