Activate PDF TEXT plugin fails thinks pdftotext is not installed.

Hello,

I have a problem Installing the PDF Text plugin in Omeka 2. When I click install in the Plugins screen it says:

"The following error occurred while installing the PdfText plugin: The pdftotext command-line utility is not installed. pdftotext must be installed to install this plugin."

I see in the code this is from the following check:


// Don't install if the pdftotext command doesn't exist.
// See: http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
if ((int) shell_exec('hash pdftotext 2>&- || echo 1')) {
throw new Omeka_Plugin_Installer_Exception(__('The pdftotext command-line utility' . 'is not installed. pdftotext must be installed to install this plugin.'));

but .. I have pdftotext installed and can run it from the command line
On the command line if I go "hash pdftotext" it produces no output.

Any ideas?

There are no other Omeka issues, nothing in the php execution logs or apache logs.

Dave,

Dear Dave,

Where you ever able to resolve the issue? I have the same problem.

I am running Omeka on an OSX Server.

Thanks,

Anurag

In terminal, enter the following command:

hash pdftotext 2>&- || echo 1

If the output is "1" the pdftotext utility isn't installed on your server. Install it and try again.

If there is no output, you have pdftotext installed, and I'm unsure why the plugin is not installing.

When I run the command, I don't get any output at all. What should it be?

I installed pdftotext for OSX from here - http://www.bluem.net/en/mac/packages/ - and I can successfully access it via the terminal. When trying to install the plugin I still get the error message. Perhaps it is looking for it in the wrong place /path?

Do you know where on the system the utility got installed? (which pdftotext should tell you if you can just normally run it with pdftotext)

The installer package you point to could have easily installed it to some nonstandard location that will work for your particular user account, but still be inaccessible for the web server.

As far as I can tell it is installed in /usr/local/bin - at least this is what it returns when running which pdftotext

Let me see if there is a permission issue.

I confirmed that the server can execute shell_exec() commands in general by running

<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>

which created the expected output.

If I understand the bash command correctly, it should output "1" if the program is not installed, correct?

That would be an explanation as to why when I execute it directly in terminal I don't get any output, but when I run it as a PHP command it does return a "1". So there must be a permission issue somewhere.

Apache runs as "_www".

It could also be as simple as /usr/local/bin not being in the PATH for the Apache user.

Yes, that seems to be the case!

Now I only need to figure out how to add it to the Apache path - OSX Server likes to use it's own Apache setup.

Bingo! John, you were absolutely right on.

In order to include /usr/local/bin to the Apache PATH, it was necessary to modify : /System/Library/LaunDaemons/org.apache.httpd.plist, adding the following:

<key>EnvironmentVariables</key>
<dict>
  <key>PATH</key>
  <string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
</dict>

Once I restarted the server, the path was included and the plugin installed correctly.

Now if <key>EnvironmentVariables</key> already exists, then just add the PATH key and values to the existing definitions.

Thanks for your help in this matter, John.