Wordpress Cronjob not working

Hello community, hope you’re doing well.

I changed the Control Panel of my VPS to Hestia.

Before Hestia I was using the following cronjob via crontab :

*/2 * * * * wget -O - http://mydomain.com/wp-cron.php?action=sln_sync_from_google_calendar

Once on Hestia I’ve set the same :

I also tried via path :

I also trie day creating a custom php file like this :


<?php
$_GET['action'] = 'sln_sync_from_google_calendar';
include 'wp-cron.php';
?>

and the call the file :

But still not working.

If done directly via the terminal here’s the output :

requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 0 [text/html]
Enregistre : ‘wp-cron.php?action=sln_sync_from_google_calendar’

wp-cron.php?action=sln_sync_from_google_calendar [ <=> ] 0 --.-KB/s ds 0s

2024-07-14 21:32:26 (0,00 B/s) - ‘wp-cron.php?action=sln_sync_from_google_calendar’ enregistré [0/0]

The size of the response is 0, which might indicate that the script didn’t execute

How can I fix this issue please ?

Thank you very much in advance

Hi @IchCodes,

This cron job should work fine:

/usr/bin/wget -O - http://mydomain.com/wp-cron.php?action=sln_sync_from_google_calendar

I know nothing about wordpress cron but one thing is to know whether the command is being executed and another thing is whether it does what you expect.

If you want to check whether the cron job is being executed:

grep wp-cron /var/log/syslog

As far as I know, to use “real” cron jobs, you should disable wp cron:

define( 'DISABLE_WP_CRON', true );

Hi @sahsanu,

Thanks for your reply.

I’ve disabled wp-cron to test :

Then I keep the /usr/bin/wget -O - http://mydomain.com/wp-cron.php?action=sln_sync_from_google_calendar as cronjob as user and admin:

However it seems to be called but the result expected is not good.

Just to be clear it’s not the first time I set up this workflow without Hestia and it always worked .

Maybe some file permissions ?

Alos I noticed that the manual command output on the server with Hestia is not the same as the server without it :

Non Hestia :

URL transformed to HTTPS due to an HSTS policy
–2024-07-16 00:39:27-- https://adomain.com/wp-cron.php?action=sln_sync_from_google_calendar
Resolving adomain.com (adomain.com)… 51.xx.7.xx
Connecting to adomain.com (adomain.com)|51.xx.7.xx|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [text/html]
Saving to: ‘STDOUT’

  •                                          [ <=>                                                                                   ]       0  --.-KB/s    in 0s      
    

2024-07-16 00:39:27 (0,00 B/s) - written to stdout [0]

Hestia :

–2024-07-16 00:38:55-- http://anotherdomain.fr/wp-cron.php?action=sln_sync_from_google_calendar
Resolving [hair7](http://anotherdomain.fr).fr (hair7.fr)… 51.xx.47.:baby::no_entry_sign:
Connecting to hair7.fr (hair7.fr)|51.xx.47.xx|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 0 [text/html]
Saving to: ‘STDOUT’

  •                                          [ <=>                                                                                   ]       0  --.-KB/s    in 0s      
    

2024-07-16 00:38:55 (0,00 B/s) - written to stdout [0/0]

If the command is executed, then the problem is in Wordpress.

Just in case, enclose the url in quotes and use https instead of http:

/usr/bin/wget -O - "https://mydomain.com/wp-cron.php?action=sln_sync_from_google_calendar"

Thanks @sahsanu, even with quotes nothing.

For info I’ve done a fresh install of wordpress in a server non managed by Hestia, imported the site done on the Hestia ops and cron works…

I’m quite sur that the access to the wp-cron file is blocked by a permission or whatever

if someone could help me to figure out which one it will save me …

Maybe it is trying to use one of the disabled php functions. You should check the web server log to view any error.

Just to test, edit the php.ini for your php version. If it is php 8.2, edit this file (first backup the file):

/etc/php/8.2/fpm/php.ini

And replace:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,pope

by

disable_functions = 

After that, save the file and restart php:

systemctl restart php8.2-fpm

Warning: enabling all those functions is a security risk, this is just to test whether any disabled function is required to run wp-cron

@sahsanu done but not working.
I have also reboot the server just in case but still nothing

Seems to me that you cron is working ok, and making a call to that webpage.
If I manually browse to that page, it doesn’t output a thing.
So it is normal that wget downloads 0 bytes.
Anyway, check your cron and webserver logs to find out.