0

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?

4

1 回答 1

0

从评论中感谢Walter告诉我实际检查错误日志。

该脚本是可执行的 ( chmod 755) 但层次结构中的目录是rwxr-x---; 更新此目录以rwxr-xr-x解决问题。'd 脚本路径上的每个目录都exec()必须可由httpd.

问题解决了。

于 2013-06-14T03:43:36.263 回答