phpshell-execpdftotextxpdf

shell_exec() not executing pdftotext command


I installed the required library and its working in terminal but not in my php file. My code is :

$mypdf = shell_exec('/usr/local/bin/pdftotext test.pdf test.txt');
echo $mypdf;

If I execute this command /usr/local/bin/pdftotext test.pdf test.txt in terminal it works fine.

I also write my code this type :

shell_exec('/usr/local/bin/pdftotext test.pdf test.txt');
$mypdf = file_get_contents("test.txt");
echo $mypdf;

In Error Log the message is :

/usr/local/bin/pdftotext: /opt/lampp/lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/i386-linux-gnu/libstdc++.so.6)

Solution

  • I think you have some trouble with a dependency. Check your error.log. Find out which file is missing and add it to the path environment variable of your php installation.