CiviCRM / Wordpress cron no longer working under php8, grumbles ensue

Update: Found a solution

Back when I became a MUG board member one of the first things that I did was figure out how to automate our membership system. The previous system required the board to mail out envelopes to our current member asking them to renew by check. It was pretty labor-intensive, and I figured that as a group of computer professionals we could do better with computers and automation. We already had a Wordpress instance so I looked around and found CiviCRM, which fit our needs nicely while bringing some additional features.

Fast forward to today and CiviCRM is proving to be labor intensive in a few key ways.

Under the recommendation of the software we moved to the later versions of PHP (PHP 8.2 as of this writing). Most things under CiviCRM seem to hod together, save for some warning messages that I haven't been able to track down. But for the most part things work well.

Unfortunately one of the things that doesn't work is cron. This is what Unix systems use to run scheduled jobs to do maintenance tasks (clean caches, send out renewal notes to expired members, and other crucial tasks). This has now fallen to me as a task that I need to do on a daily basis lest things fall apart.

And when I run the cron job directly it comes back almost immediately with the following:

mugorg@mi3-ss17 [~/www/wp-content/plugins/civicrm]# cv api job.execute --user=cron 
    "is_error": 0,
    "version": 3,
    "count": 1,
    "values": 1
mugorg@mi3-ss17 [~/www/wp-content/plugins/civicrm]#

This is using cv, which is apparently their new-and-improved cli.php, but just so I don't get someone telling me that I'm "holding it wrong" here is the same with cli.php:

mugorg@mi3-ss17 [~/www/wp-content/plugins/civicrm]# cd /home/mugorg/public_html/wp-content/plugins/civicrm/civicrm && \
    /usr/local/bin/php bin/cli.php \
    -u cron \
    -p [redacted] \
    -s \
    -e Job \
    -a execute \
    --output \
    "is_error": 0,
    "version": 3,
    "count": 1,
    "values": 1

This is, to put it mildly, irritating. Nothing appears to be wrong but nothing seems to be happening either. If I check CiviCRM's "Scheduled Jobs" logs they don't show anything happening.

It's basically playing with a busybox, smiling, and saying "yup! I did the thing" while doing nothing of consequence.

And this is where I have a slight grumble with the Wordpress, CiviCRM, and shared hosting community. Searching online for an issue like this is next to impossible because not everyone who installs CiviCRM does things the Unix way (using cron on the local system) either because they don't know to do so or because it's not available to them. So you'll find solutions like "run wget -O longstring to run those scheduled jobs", or "use Wordpress' scheduled jobs", or worse "have you turned on cron", which are perfectly valid solutions but are completely lacking for someone who understands how Unix works, is comfortable with the Unix shell, and isn't afraid to open up vi and edit files. Worse, CiviCRM isn't used by a lot of organizations (compared with Wordpress) so I'm reliant on finding someone else that's running into the same issue and hoping that they found a solution.

And before someone else decides to offer alternatives, I spent this afternoon doing just that. There are some great packages out there (Tendenci and Admidio were ones that I checked out) save for the following:

  • Tendenci is written in Python so I'd need to reconfigure our entire hosting platform to make this work. Worse, it brings the same complexity that CiviCRM has. The only major bonus is that it isn't reliant on Wordpress.
  • Admidio feels pretty lightweight except that it doesn't do the membership management that we need and doesn't take online payment, nor does it have any plans to do so.

So we're kinda stuck with CiviCRM for now.

But therein lies the issue. Wordpress is getting way too complex for its own good while it chases after some notional new users to convert to the platform and CiviCRM's integration feels more and more fraught with each update. It doesn't feel like a question of if this will break but when and at what cost.

Honestly at this point I feel like instituting a static site with some back-end processing to handle memberships and the like. I feel like this is the way forward out of this mess.

That said, if anyone can help with the above pain point of getting CiviCRM's cron to work I'd be much obliged. Maybe it can keep me away from the siren sound of implementing my own damn infrastructure.