Reputation: 4684
Code:
shell_exec('libreoffice --convert-to pdf `'.$my_file.'` --headless');
I have tried this too
shell_exec('libreoffice --convert-to pdf `'.$my_file'` --headless > /dev/null');
Error on the server while executing above:
Output:sh: /my_files/my_file.doc: cannot execute binary file
Note: All other commands of linux working fine with shell_exec()
just libreoffice
command not working. And on linux terminal the libreoffice
command working fine just not working using PHP
.
Upvotes: 0
Views: 143
Reputation: 22274
You're using backticks, which tells the subshell to run that command and use its output in its place. Use double quotes instead, and it will work far more often.
Upvotes: 1