CSV Importer and PHP CLI path

So I’m getting the error that other have had. But when I check my hosting they inform me that:
Path to PHP
/usr/local/bin/php
If I add this info the the config.ini
background.php.path = “/usr/local/bin/php-cli”
or
background.php.path = “/usr/local/bin/php”

I still get the php-cli path error.

Any ideas?

I have multiple hosting services. So I tried this on both services, different path depending on the hosting service, and I’m getting the error on both sites.

RuntimeException: The configured PHP path (/usr/local/bin/php) does not point to a PHP-CLI binary.

If I run php -v from the path I see that php is indeed there 7.2.31 (cli)

Am I missing something?

Thanks

I’ve tried everything and can’t get it to work. Tried setting every conceivable path, adding symlinks, setting CLI in bash, etc…
Zip. I can’t get it to work.
Thanks

In general, all you should have to do is find the path to the PHP CLI binary, and set that path as the value of background.php.path in application/config/config.ini.

@jscott What’s the full, exact output of running the command /usr/local/bin/php -v on these servers? @DavidGhedini, same question with whatever the relevant path on your server.

InkedMicrosoftTeams-image_LI (2)

I ended up doing this to avoid the php-cli

jobs.dispatcher.default = "Omeka_Job_Dispatcher_Adapter_Synchronous"
jobs.dispatcher.longRunning = "Omeka_Job_Dispatcher_Adapter_BackgroundProcess"

Change the jobs.dispatcher.longRunning setting to also be Omeka_Job_Dispatcher_Adapter_Synchronous

Then ran the importer with only 10 rows and just did multiple imports

The error you posted gets thrown when we try to execute that -v command and the output doesn’t look like PHP X.Y.Z

Yours does look normal, how we’d expect. I’m thinking the issue here may be instead something like the relevant functions PHP uses to run commands (here, exec) simply being disabled. It’s not hugely uncommon for web hosts to disable exec and other similar functions.

I am currently hosting Omeka on Godaddy for anyone that stumbles upon this in the future.

Hi,
Thanks for the reply.
I am getting the issue when trying to generate Reports.
The output from php -v is:

PHP 7.2.31 (cli) (built: Jun 30 2020 02:57:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Which is what is expected.

For background.php.path, I’ve tried using:

  • /opt/cpanel/ea-php72/root/usr/bin/php
  • /usr/bin/php
  • /usr/local/lib/php

I’ve also tried:

  • symlinks
  • Setting an alias via bash profile/rc
  • Changing the PHP version to rule our compile errors for CLI

It seems no matter value I provide, the error persists.
OS is CentOS 7.x

Thanks again,
David

Figured this out. It was a disabled exec function in php-fpm function:

vi /opt/cpanel/ea-php72/root/etc/php-fpm .d /domain .tld.conf

php_admin_value[disable_functions] = passthru,shell_exec,system

Thanks again and hope above helps someone else.