简体   繁体   中英

Execute perl script from PHP with Codeigniter

i have one problem with php and perl, i need execute perl script, from my website php with codeigniter, but the execution of the script is not evident. I explain better.

The perl Script generate one csv file, when i execute in console, it works perfectly, but when I run it from PHP, it does not generate the file, and it does not give any errors during the execution, so I think, it's just not running.

the script needs 3 input parameters, which are previously concatenated in the execution of the same. But even when I try to force the execution of the script, placing the values inside the execution command, nothing happens.

I have tried to execute it in the following ways:

$perl_script = './zc_csv_dist_crd_3.pl' . ' ' . $ctac_corre . ' ' . $codigo. ' ' . $num_dist;
exec($perl_script);

or

system($perl_script);

or directly

shell_exec("./zc_csv_dist_crd_3.pl 7736 311745421 42906");
#or
exec("./zc_csv_dist_crd_3.pl 7736 311745421 42906");
#or
system("./zc_csv_dist_crd_3.pl 7736 311745421 42906");

I want to clarify that I do not need a return value, even the perl script, has no return value, since the file is generated empty or with data, and both cases are valid. I've read that it can be a problem of permission, but I'm new to perl, php and linux. I leave the linux server features, with the hope that someone can guide me.

Very grateful with your help in advance.

PD: I have read patiently, the forums in stackoverflow, the PHP manuals and even then I can not make it work, I know I'm jumping something, but I can not see it by now.

You probably have your PHP code running in Safe Mode , which in your case will not allow you to use the functions you mentioned, check this out Safe Mode Functions

I found out that there are some similar questions to yours in these links: Question 1 Question 2

I hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM