我试图通过和(pdftotext.exe)将pdf解析为文本。在我的本地主机上一切正常,但是当我试图移动服务器上的所有内容时,我遇到了麻烦。PHP
XPDF
首先,我检查了服务器上的一些设置,并且安全模式已关闭,exec未禁用且权限为rwxrwxrwx
。
然后我试试这个
$command = "\\\\149.223.22.11\\cae\\04_Knowledge-base\\tools\\pdftotext.exe -enc UTF-8 ". $fileName . " \\\\149.223.22.11\\cae\\04_Knowledge-base\\output.txt";
$result = exec($command,$output,$args);
echo shell_exec($command);
这不起作用。当我查看为$result, $output,
空时,但 $args 返回 1,这与此文档windows 系统错误代码对应的函数不正确
整个命令看起来像\\149.223.22.11\cae\04_Knowledge-base\tools\pdftotext.exe -enc UTF-8 \\149.223.22.11\cae\04_Knowledge-base\testpdf\04_egerland_final_paper.pdf \\149.223.22.11\cae\04_Knowledge-base\output.txt
,当直接输入到命令行时,它的工作。
所以我有点没有想法。有人有任何提示吗?
编辑 20160201 - 附加尝试所以我做了附加测试,当我尝试从 localhost 运行类似的命令时(目标 .exe 文件,输入和输出文件位于同一位置,只有我使用 localhost 而不是服务器)它的工作。我现在检查服务器设置的差异。那么这里有问题吗,localhosts Server Api 是Apache 2.0 Handler 而服务器是CGI/FASTCGI吗?