using shell_exec to call a perl script from php

后端 未结 2 686
野的像风
野的像风 2021-01-25 03:50

I am having an issue with executing a perl script from php using the shell_exec() function.

This is what I have tried (and it has worked before).

$perl =         


        
相关标签:
2条回答
  • 2021-01-25 04:13

    Try this:

    $perl = shell_exec("/usr/bin/perl cbh_script_clean.pl 2>/dev/null >/dev/null &"); echo ($perl);

    0 讨论(0)
  • 2021-01-25 04:20

    I'll make that an answer then.

    You can often append 2>&1 to redirect the stderr output to the normal stdout stream. This way you receive any error messages in the PHP variable. (Otherwise they will get lost with system/exec/shell_exec, which is why people sometimes use proc_open with explicit pipes instead).

    $perl = shell_exec("/usr/bin/perl cbh_script_clean.pl 2>&1");
    echo ($perl);
    
    0 讨论(0)
提交回复
热议问题