Your command to start pdftotext is incorrect.
There should be a second argument indicating pdftotext to write to a specific file or just use the dash ā-ā to write to stdout, if you really do not want the program to create a text file with the file name as pdf (this will require write permissions in the folder /opt/lampp/.../)
This is at least true for pdftotext version 0.12.4
"Pdftotext reads a PDF file, a PDF file, and writes a text file, a text file. If no text file is specified, pdftotext converts the .pdf file to file.txt. If the text file is" - ", the text is sent to standard output."
So, solving your question will simply add a dash after the file name, for example:
<?php $pdftext = shell_exec('/usr/bin/pdftotext /opt/lampp/htdocs/foldername/filename.pdf -'); echo $pdftext;
Given the existence of the binary and PHP, shell_exec is allowed to use, and you have permissions and that the pdf file exists, and you have permissions.
source share