I'm trying to launch unoconv using exec in php. It works with apache2, but not with nginx. I've already checked my php.ini and disable_functions not contain exec in both apache2 and nginx php.ini files.
I'm not familiar with unconv, but I've had a similar problem with porting my server from Apache
to nginx
and exec
.
nginx
+ php-fpm
have a bare minimal $PATH
set compared to apache
, and it's likely your unoconv
is not on that path.
You could try modifying your PATH settings, but a better way would be to specify the absolute path of unoconv
You can find the absolute path by using
which unoconv
You should also re-direct the error output to stdout, so you can see exactly why unoconv isn't starting
exec("/path/to/unoconv -param0 -param1 2>&1", $output);
print_r($output); //this should give failure reason
Check out this post : PHP exec() does not run all commands
As said in this post :
The problem is that you're running notify-send from a service. Notify-send is a desktop-oriented program which interacts with the display. But nginx runs without being attached to a display.
Imagine, for example, that there are 3 people logged on to the computer at the same time, all with different displays. When notify-send runs, it wouldn't know which display to send the notification to.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.