Perl in Yii

Hi, i want to have a php call to perl script.

example:($out=shell_exec("$perl first.pl")).

first.pl is my perl file. How can i do that in yii framework. can anyone help me please??

You can do it like in your example. Any problems with it?

Hi,

Its now working…

I have created a controller named login, and inside this i am having both "first.pl" and "sample.php".

(sample.php)

$out=shell_exec("$perl first.pl");

$storage=explode("\n",$out);

echo "$storage";

(first.pl)

print("Hello world!!");

when i place this code inside sample.php, simply its showing the output as "Array" instead of "Hello World"… its not executing the Perl script actually… what i have to do for executing the Perl script.

(I have installed Yii inside Wamp(\wamp\ WWW\Yii) and i have installed Perl inside(\wamp\bin\ Perl).

Is the procedure correct? r else if i did any mistakes please specify…

$storage=explode("\n",$out); give you array. You can not just echo it. Try:




$out=shell_exec("$perl first.pl");

$parts=explode("\n",$out);

foreach($parts as $part)

    echo $part;



And, there is no need in sample.php, you can add this code in controller action directly.

Hi,

Now i am able to execute a perl script inside Yii framework.

Mistake that i made was

Initially i have given as

$out=shell_exec("$perl first.pl");

i have changed it to

$out=shell_exec("$perl \wamp\www\myYii\protected\views\login\first.pl");

I have to specify the absolute path.