Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using ubuntu with libreOffice. I have installed unoconv for convert a *.odp file to *.pdf. When i run the command unoconv -f pdf myfile.odp from terminal then it works very fine. I want to do the same thing with using PHP shell_exec() method. So, I wrote the following code:

$output = shell_exec('unoconv -f pdf test.odp 2>&1');
echo $output;

But it shows the following error:

/usr/bin/python: /opt/lampp/lib/libz.so.1: no version information available (required by /usr/bin/python) 
Traceback (most recent call last): File "/usr/bin/unoconv", line 24, in import uno,
unohelper File "/usr/lib/python2.7/dist-packages/uno.py", line 34, in import pyuno SystemError: dynamic module not initialized properly

How can I solve this problem?

Thanks in advance.

share|improve this question
add comment

1 Answer

Apach may be configured to disallow calling some command/libs...

But maybe environment variables (e.g. $PATH...) are not just the same for your user and Apach user (www-data) or something like that.

Here is an example what you can do to search the issue:

Try to call set or setenv to get the list of the variables.

Create a basic script callset.sh:

#!/bin/bash
set

(do not forget chmod +x callset.sh to give execution permission):

Then call this bash script from PHP:

$output = shell_exec ('/your/dir/callset.sh 2>&1');
echo $output

or

exec ("/your/dir/callset.sh", $output, $exitstatus);
print_r ($output);

Then check the difference with your own set call.

Finally provide the missing variables like that:

$output = shell_exec('PATH=aaa:bbb:ddd unoconv -f pdf test.odp 2>&1');
share|improve this answer
    
Thank you for answer but still have same problem.... –  Arif Jan 20 '12 at 9:05
    
Hi @Arif. What have you tested? Differences within the environment variables? Have you tried to log on using Apach user (www-data) and then to run unoconv? –  olibre Jan 20 '12 at 14:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.