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?
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.