php - sh:pdftotext:找不到命令
问题描述
我有一个 PHP 页面,它调用 pdftotext 命令将 pdf 文件转换为文本文件,然后进行一些后续处理。我使用 shell_exec 命令来执行 pdftotext 命令。
在执行时,我收到以下错误:
sh: pdftotext: command not found
代码:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$url = 'https://testdomain.com/sample.pdf';
$contents = file_get_contents($url);
file_put_contents('delta_file.pdf', $contents);
echo shell_exec("pdftotext -layout delta_file.pdf text_contents.txt 2>&1");
我究竟做错了什么?我已经安装了pdftotext。
有任何想法吗?
解决方案
推荐阅读
- google-sheets - 从 Google 表格行创建 Google 日历活动
- php - RainTPL {loop} 只显示数组的最后一个索引
- visual-studio-code - 在 VS Code 中,如何将终端带到代码编辑器部分(无需调整终端大小)?“终端编辑器”
- javascript - 使自定义光标转换在 Safari 中工作
- gradle - 如何配置 sonar.junit.reportPaths
- python - 如何将 .txt 文件中的特定单词作为字符串变量导入 Python?
- php - 如何使用php正则表达式
- azure - 如何将 Azure AD B2C 注册限制为用户发起的请求
- python - LDA2Vec 中的 int64 词汇表
- email - docker-compose 运行 nginx-proxy 和 mailu 作为邮件服务器错误