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?
sudoat the very least needs a password, no?sudo, so it gets the permissions you used before?shell_execreference page specifically what was mentioned aboutsudoneeding a password and also the possibility that you might need to redirectstderrtostdout(2>&1) to get any output.stderrto/dev/nulland see if you still get outputpdftohtml 2>/dev/null -c -noframes "documents/document1.pdf". If you don't see anything then it means that the output is written tostderrand you'll need to redirectstderrtostdoutforshell_execto give any output.