pgrevents Posted June 12, 2009 Share Posted June 12, 2009 All i need for php is to run the file i dont need anything returned any ideas. Everything I have tried so far fails cheers Quote Link to comment https://forums.phpfreaks.com/topic/161926-running-a-perl-script-from-php/ Share on other sites More sharing options...
pgrevents Posted June 12, 2009 Author Share Posted June 12, 2009 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/161926-running-a-perl-script-from-php/#findComment-854432 Share on other sites More sharing options...
pgrevents Posted June 12, 2009 Author Share Posted June 12, 2009 Right i have stripped all that down to this and I have got this so far <?php <?php shell_exec('$get_iplayer --info > output.txt'); ?> The output.txt file is being created but I am trying to pass the command info to it ???? Quote Link to comment https://forums.phpfreaks.com/topic/161926-running-a-perl-script-from-php/#findComment-854568 Share on other sites More sharing options...
mikemike Posted June 12, 2009 Share Posted June 12, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/161926-running-a-perl-script-from-php/#findComment-854573 Share on other sites More sharing options...
byte1918 Posted June 12, 2009 Share Posted June 12, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/161926-running-a-perl-script-from-php/#findComment-854610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.