On the terminal, I run this successfully within the web application's directory:
pdftohtml -c -noframes "documents/document1.pdf"
Now I want to do this through PHP, so I wrote a shell.sh
file that looks like this:
sudo pdftohtml -c -noframes "documents/$file"
exit 0
Then I wrote this in php:
$output = shell_exec("file='document1.pdf' shell.sh");
It doesn't work, I expect to see html files generated, but I get some empty html files..since the command worked fine through the terminal, then I think the problem is in the way I execute it from php
echoing $output doesn't show anything.. what do I do wrong?
You need specify path to the script (or ./
if it is the current directory):
shell_exec("file='document1.pdf' ./shell.sh")