【问题标题】:shell_exec to run a Perl fileshell_exec 运行 Perl 文件
【发布时间】:2012-05-26 17:02:31
【问题描述】:
$cmdOutput = shell_exec("perl run_single_test/hello.pl");
echo "the command output = $cmdOutput";

这会导致文件hello.pl 执行并打印“hello world back to page”。但是

shell_exec("perl run_single_test/test_single_run.pl -s \"$testSuiteName\" -t \"$testName\" -i $time");

不会被执行。我将命令回显到屏幕并在终端上运行,Perl 脚本完美执行。 test_single_run.pl 创建一个日志文件并复制一些文件。

我错过了什么?

【问题讨论】:

  • test_single_run.pl的权限和hello.pl的权限一样吗?
  • @daxim: shell_exec 是 PHP 内置函数。

标签: php perl apache


【解决方案1】:

终于找到答案了。 test_single_run.pl 正在修改其他目录中的一些文件。 我知道 apache 以不同的用户身份运行 perl 脚本。在我的情况下,它是wwwrun,因此缺乏操作其他文件的权限。

更改了配置文件uid.conf 以使apache 以我的用户身份运行perl 脚本。它奏效了

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-10
    • 2011-05-07
    • 2012-05-15
    • 2015-05-26
    相关资源
    最近更新 更多