1

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.

1
  • Please provide more details of your code, how you are testing it, and the exact wording of any errors you receive. Otherwise, we are basically having to guess all these things rather than concentrating on your problem. Commented Jun 8, 2014 at 16:58

2 Answers 2

2

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
Sign up to request clarification or add additional context in comments.

2 Comments

Since the environment is different, there may be other factors at work as well. Updated my answer.
Thankyou! You was right. When I re-directed my output I got error form unoconv and add this line to my php script putenv('PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/node/bin');. Now it's work well.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.