vaites / php-apache-tika

Apache Tika bindings for PHP: extract text and metadata from documents, images and other formats
MIT License
116 stars 22 forks source link

CLIClient fails on Windows #9

Closed caugner closed 6 years ago

caugner commented 6 years ago

I tried to use the CLIClient on Windows, but got two problems:

  1. The file /tmp/tika-error.log does not exist, which yields a warning [1].
  2. The Windows Commandline doesn't seem to like the single quotes around the paths, which yields an error [2].

[1] Warning: proc_open(/tmp/tika-error.log): failed to open stream: No such file or directory in C:\path\to\my\application\vendor\vaites\php-apache-tika\src\Clients\CLIClient.php on line 120 [2] Error: Unable to access jarfile 'C:\path\to\my\application\bin\tika.jar'

Solutions:

  1. Use sys_get_temp_dir() instead of "/tmp/" here.
  2. Use escapeshellargs() instead of single quotes here.

I will submit a PR in a minute.

vaites commented 6 years ago

Thanks @caugner, I don't test all the features in Windows yet. Will review your patch and release the fixes ASAP.

vaites commented 6 years ago

Merged and released new version. Thanks!