从PHP/Apache运行Perl脚本 [英] Run a Perl Script from PHP/Apache

查看:57
本文介绍了从PHP/Apache运行Perl脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在RED HAT LINUX上:运行APACHE

On RED HAT LINUX: Running APACHE

从PHP脚本中,我想运行Perl脚本,并尝试使用以下命令进行操作:

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); 

这似乎失败了,因为PERL脚本需要由另一个用户(USER1)运行.

This seems to fail because the PERL script needs to be run by another user (USER1).

我尝试使用SUDO失败.我必须以(USER1)而不是用户(APACHE)身份运行脚本,因为(USER1)拥有比APACHE用户更多的特权.

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.

知道我将如何做吗?

推荐答案

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

这篇关于从PHP/Apache运行Perl脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆