PHP-XPDF
PHP-XPDF copied to clipboard
Executable not found, proposed : /opt/local/xpdf/bin/pdftotext
I have used the following initialization:
$pdfToText = XPDF\PdfToText::create(array(
'pdftotext.binaries' => '/usr/bin/pdftotext', // notice here I have given a path to pdftotext executable on my pc
'pdftotext.timeout' => 30, // timeout for the underlying process
));
but still it is finding the executable in '/opt/local/xpdf/bin/pdftotext' and giving me the following error trace:
[Mon Aug 22 15:24:34.602132 2016] [:error] [pid 5912] [client 127.0.0.1:44733] PHP Fatal error: Uncaught exception 'Alchemy\\BinaryDriver\\Exception\\ExecutableNotFoundException' with message 'Executable not found, proposed : /opt/local/xpdf/bin/pdftotext' in /var/www/html/PHP-XPDF/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:160\nStack trace:\n#0 /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php(196): Alchemy\\BinaryDriver\\AbstractBinary::load('/opt/local/xpdf...', NULL, Object(Alchemy\\BinaryDriver\\Configuration))\n#1 /var/www/html/PHP-XPDF/index.php(8): XPDF\\PdfToText::create(Array)\n#2 {main}\n\nNext exception 'XPDF\\Exception\\BinaryNotFoundException' with message 'Unable to find pdftotext' in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php:198\nStack trace:\n#0 /var/www/html/PHP-XPDF/index.php(8): XPDF\\PdfToText::create(Array)\n#1 {main}\n thrown in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php on line 198 [Mon Aug 22 15:24:35.537723 2016] [:error] [pid 4627] [client 127.0.0.1:44734] PHP Fatal error: Uncaught exception 'Alchemy\\BinaryDriver\\Exception\\ExecutableNotFoundException' with message 'Executable not found, proposed : /opt/local/xpdf/bin/pdftotext' in /var/www/html/PHP-XPDF/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:160\nStack trace:\n#0 /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php(196): Alchemy\\BinaryDriver\\AbstractBinary::load('/opt/local/xpdf...', NULL, Object(Alchemy\\BinaryDriver\\Configuration))\n#1 /var/www/html/PHP-XPDF/index.php(8): XPDF\\PdfToText::create(Array)\n#2 {main}\n\nNext exception 'XPDF\\Exception\\BinaryNotFoundException' with message 'Unable to find pdftotext' in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php:198\nStack trace:\n#0 /var/www/html/PHP-XPDF/index.php(8): XPDF\\PdfToText::create(Array)\n#1 {main}\n thrown in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php on line 198 [Mon Aug 22 15:24:36.380343 2016] [:error] [pid 7571] [client 127.0.0.1:44735] PHP Fatal error: Uncaught exception 'Alchemy\\BinaryDriver\\Exception\\ExecutableNotFoundException' with message 'Executable not found, proposed : /opt/local/xpdf/bin/pdftotext' in /var/www/html/PHP-XPDF/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:160\nStack trace:\n#0 /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php(196): Alchemy\\BinaryDriver\\AbstractBinary::load('/opt/local/xpdf...', NULL, Object(Alchemy\\BinaryDriver\\Configuration))\n#1 /var/www/html/PHP-XPDF/index.php(8): XPDF\\PdfToText::create(Array)\n#2 {main}\n\nNext exception 'XPDF\\Exception\\BinaryNotFoundException' with message 'Unable to find pdftotext' in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php:198\nStack trace:\n#0 /var/www/html/PHP-XPDF/index.php(8): XPDF\\PdfToText::create(Array)\n#1 {main}\n thrown in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php on line 198 [Mon Aug 22 15:34:10.858116 2016] [:error] [pid 10193] [client 127.0.0.1:44883] PHP Fatal error: Uncaught exception 'XPDF\\Exception\\InvalidArgumentException' with message 'sample.pdf is not a valid file' in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php:133\nStack trace:\n#0 /var/www/html/PHP-XPDF/index.php(10): XPDF\\PdfToText->getText('sample.pdf')\n#1 {main}\n thrown in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php on line 133 [Mon Aug 22 15:39:16.753952 2016] [:error] [pid 4631] [client 127.0.0.1:44902] PHP Fatal error: Uncaught exception 'XPDF\\Exception\\InvalidArgumentException' with message 'sample.pdf is not a valid file' in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php:133\nStack trace:\n#0 /var/www/html/PHP-XPDF/index.php(10): XPDF\\PdfToText->getText('sample.pdf')\n#1 {main}\n thrown in /var/www/html/PHP-XPDF/src/XPDF/PdfToText.php on line 133
Can you post the output of the following commands:
ls -la /usr/bin/pdftotext
ls -la /opt/local/xpdf/bin/pdftotext
output of ls -la /usr/bin/pdftotext
:
-rwxr-xr-x 1 root root 26832 Apr 30 02:14 /usr/bin/pdftotext
and ls -la /opt/local/xpdf/bin/pdftotext
:
ls: cannot access /opt/local/xpdf/bin/pdftotext: No such file or directory
hi @sagarguhe , @aztech-dev ! Having no problems with the windows binary, but as some of my co-workers use linux/MacOS , can I have a gist on how and why this problem occurs?
Great library btw!
@fabre-thibaud have you been able to fix? I'm having the same issue