3

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.

9
  • CentOS Linux release 7.3.1611 (Core) NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="centos.org" BUG_REPORT_URL="bugs.centos.org" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" CentOS Linux release 7.3.1611 (Core) CentOS Linux release 7.3.1611 (Core) Commented Sep 27, 2018 at 21:18
  • thar is the linux server Commented Sep 27, 2018 at 21:18
  • 1
    Have you checked the return value? If not, you should so that you can narrow down the problem. The perl script could be failing to execute or it does execute but throws a fatal error. Commented Sep 27, 2018 at 21:29
  • 1
    Have you tried using the full path instead of the relative path? Commented Sep 27, 2018 at 21:31
  • Ron, i Use the full path, and the perl script, it works well, I even show on the screen, the command to execute it, I copy it and execute it on the server console, and it runs without problems, or errors Commented Sep 28, 2018 at 11:25

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.