从 PHP/Apache 运行 Perl 脚本
在 RED HAT LINUX 上:从 PHP 脚本运行 APACHE
我想运行 Perl 脚本,并尝试使用以下命令来执行此操作:
exec("/usr/bin/perl /home/path/to/perlscript/main.pl", $output, $result);
这似乎失败,因为 PERL 脚本需要由另一个用户 (USER1) 运行。
我尝试使用 SUDO 但没有成功。我必须以 (USER1) 而不是用户 (APACHE) 身份运行脚本,因为 (USER1) 比 APACHE 用户拥有更多权限。
知道我该怎么做吗?
On RED HAT LINUX: Running APACHE
From a PHP script I want to run a Perl script and am trying to do so with the following command:
exec("/usr/bin/perl /home/path/to/perlscript/main.pl", $output, $result);
This seems to fail because the PERL script needs to be run by another user (USER1).
I have tried without success to use SUDO. I have to run the script as (USER1) instead of user (APACHE) because (USER1) has more privileges than APACHE user.
Any idea how I would do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在完全了解 Perl 脚本正在做什么的情况下,也许可以考虑运行一个运行 Perl 脚本的 cronjob。这样,它就完全与 Apache 隔离,并且仍然可以以 root 身份运行,而不会影响您的服务器。
Without fully knowing what your perl script is doing, maybe consider running a cronjob that runs the perl script. This way it's isolated from Apache altogether and still can operate as root without compromising your server.