简体   繁体   English

使用Codeigniter从PHP执行perl脚本

[英]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. 我有一个问题与PHP和perl,我需要执行perl脚本,从我的网站php与codeigniter,但脚本的执行不明显。 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. perl脚本生成一个csv文件,当我在控制台中执行时,它工作得很好,但是当我从PHP运行它时,它不会生成文件,并且它在执行期间不会出现任何错误,所以我想,它只是没跑

the script needs 3 input parameters, which are previously concatenated in the execution of the same. 该脚本需要3个输入参数,这些参数先前在执行时连接在一起。 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. 我想澄清一下,我不需要返回值,即使perl脚本也没有返回值,因为文件生成为空或带有数据,并且两种情况都是有效的。 I've read that it can be a problem of permission, but I'm new to perl, php and linux. 我已经读过它可能是一个许可问题,但我是perl,php和linux的新手。 I leave the linux server features, with the hope that someone can guide me. 我留下了linux服务器的功能,希望有人可以指导我。

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. PD:我耐心地阅读,stackoverflow中的论坛,PHP手册,即使那时我也无法使它工作,我知道我正在跳东西,但我现在看不到它。

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 你可能让你的PHP代码在安全模式下运行,在你的情况下你将无法使用你提到的功能,请查看安全模式函数

I found out that there are some similar questions to yours in these links: Question 1 Question 2 我发现在这些链接中有一些类似的问题: 问题1 问题2

I hope it helps. 我希望它有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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