I am trying to execute /path/to/script.pl
in PHP; the script, among other things, sends an email when it's done executing. When I try
exec( "/path/to/script.pl" );
Nothing happens. Some other relevant data points:
print exec( "whoami" );
/path/to/script.pl
sudo -u apache /path/to/script.pl
The first, run in PHP, prints apache
; the second, run in the shell, operates as expected (sends the email); the third, run in the shell, also runs as expected (sends the email).
From this it seems that exec
is working fine for some commands, and that the script works, and works for the httpd
user (apache
). The script itself does no file I/O, but it does access a MySQL database and use Net::SMTP::TLS
as well as LWP::Simple
. Any ideas what could be going wrong?