1

I've been finding recently that our cron is often failing. Our host doesn't keep output from the cron processes in the logs, so it's hard to establish the differences between the times that it works and the times that it doesn't. Testing the command manually at the CLI at the moment though, I'm getting this error:

$ /usr/bin/php-7.3 /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/bin/cli.php -s civicrm.example.net -u cronuser -p password -e Job -a execute
Fatal error: Uncaught Error: Class 'Civi\Api4\Event\Subscriber\SearchKitSubscriber' not found in /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/ext/search_kit/search_kit.php:14
Stack trace:
#0 /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/CRM/Utils/Hook.php(271): search_kit_civicrm_config(Object(CRM_Core_Config))
#1 /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(73): CRM_Utils_Hook->runHooks(Array, 'civicrm_config', 1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL)
#2 /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(248): CRM_Utils_Hook_DrupalBase->invokeViaUF(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, 'civicrm_config')
#3 /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(214): Civi\Core\CiviEventDispatcher::delegateToUF(O in /var/sites/c/civicrm.example.net/public_html/sites/all/modules/civicrm/ext/search_kit/search_kit.php on line 14

This is on Drupal 7.91 and CiviCRM 5.51.1, but it's been going on for a while.

Edit 26/7/2022: I've been trying to test the command with cv, but I think something with our host is preventing it from running. I'm fairly beginner with Linux though, so maybe I'm missing something. I followed the instructions at https://github.com/civicrm/cv. I can't use sudo, but it seemed to work fine without. I don't have access to /usr/local/bin though, so just installed in ~/. Then when I try to run I see this:

$ ls cv -l
-rwxr-xr-x 1 username gid 1768622 Jul 26 12:15 cv
$ cv
bash: cv: command not found

Edit 2/8/2022: Trying to run from my Drupal root folder results in the following:

$ ~/cv list
Fatal error: Class 'Phar' not found in /var/sites/c/civicrm.example.net/cv on line 10

Edit 23/8/2022: Testing for Phar returns as follows:

$ php -i | grep phar
Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, sqlsrv, zip
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On

Edit 2/9/2022: Trying to establish if cv is using a different php isn't going very well:

$ which php
bash: which: command not found
$ /usr/bin/env which php
/usr/bin/env: which: No such file or directory

Edit 6/9/2022: PATH is as follows:

$ echo $PATH
/usr/local/bin:/usr/bin
11
  • If you run the same command with cv does it give the same error? cv api --user=cronuser Job.execute I'm wondering if bin/cli.php maybe doesn't "boot enough" for search kit.
    – Demerit
    Jul 22, 2022 at 17:30
  • @Demerit I've updated the post with the results. Maybe I've not installed it correctly, but I think maybe the host is blocking it somehow. I used to have Drush installed and it stopped working after an update the host did. That was last year some time though, long before this error, so I don't think the two are connected. Jul 26, 2022 at 16:18
  • Your home folder probably isn't in your path. Also it's easiest to run it from within the civi or drupal folder so it can figure out which site, so cd /path/to/drupal, then give the full path to cv e.g. ~/cv list
    – Demerit
    Jul 26, 2022 at 16:25
  • Huh. You have to specify full paths to execute a file in Linux? I'm even more of a beginner than I thought! Updated the question with the new error. Aug 2, 2022 at 14:11
  • No you don't but you had originally put cv in ~ which is unlikely to be in the PATH. Your new error suggests that php on that system does not include Phar, which is unusual but possible. If you run php -i | grep phar it should show some information about it if it's installed, otherwise I'd ask your host if php phar is enabled.
    – Demerit
    Aug 2, 2022 at 14:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.