从 PHP/Apache 运行 Perl 脚本

发布于 2024-12-28 13:13:40 字数 334 浏览 1 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

屌丝范 2025-01-04 13:13:41

在完全了解 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文