BFD Calendar Posted Tuesday at 10:06 AM Posted Tuesday at 10:06 AM I have a template that collects pages based on a date search (today). I send that page to a blog (https://wheniwasbuyingyouadrinkwherewereyou.blogspot.com) with php: $to = "xxxx@blogger.com"; $headers = "From: ddv@birthfactdeathcalendar.net\r\n"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; When I load the page in my browser it is sent correctly. When I have it sent by a scheduled CRON job (OVH hosting) I get this error: [2026-03-09 10:27:02] ## OVH ## START - 2026-03-09 10:27:02.711006 executing: /usr/local/php8.2/bin/php /homez.863/birthfac/www/site/templates/bfd_mailer.php [2026-03-09 10:27:02] [2026-03-09 10:27:02] [2026-03-09 10:27:02] <center> [2026-03-09 10:27:02] <table width="700"> [2026-03-09 10:27:02] <tr><td> [2026-03-09 10:27:02] <b><span style="font-size: x-large;"><span style="font-family: "Trebuchet MS",sans-serif;"> [2026-03-09 10:27:02] <a href="http://www.birthfactdeathcalendar.net">BIRTH(+)FACT(᙮)DEATH(-)</a></span></span></b> [2026-03-09 10:27:02] <br> [2026-03-09 10:27:02] <span style='font-size: large;'><span style='font-family: Georgia,"Times New Roman",serif;'>41st year - Nº 68 Monday, 9 March 2026</span></span> [2026-03-09 10:27:02] </td></tr> [2026-03-09 10:27:02] <tr><td> [2026-03-09 10:27:02] [2026-03-09 10:27:02] [2026-03-09 10:27:02] ## OVH ## END - 2026-03-09 10:27:02.781779 exitcode: 255 What could be the problem?
monollonom Posted Tuesday at 10:44 AM Posted Tuesday at 10:44 AM With a quick search it looks like this is an issue from OVH rather than from PW. Do you have enough traffic to consider using LazyCron instead?
BFD Calendar Posted Tuesday at 12:07 PM Author Posted Tuesday at 12:07 PM Thanks, looks well worth trying this. According to Matomo I had 31 visitors in the last 24 hours, according to OVH statistics it's 5000, but that includes several bots. Don't know if they will count as valid traffic.
BFD Calendar Posted Wednesday at 01:36 PM Author Posted Wednesday at 01:36 PM 10 hours ago, monollonom said: Do you have enough traffic to consider using LazyCron instead? Tried several things with LazyCron but no success yet. I tried calling it from ready.php but then -if- it works I don't think it would allow loading my bfd_mailer template once a day, say at 1pm.
monollonom Posted Wednesday at 08:13 PM Posted Wednesday at 08:13 PM 6 hours ago, BFD Calendar said: I tried calling it from ready.php but then -if- it works I don't think it would allow loading my bfd_mailer template once a day, say at 1pm. Do you mean your LazyCron hook is not triggered?
BFD Calendar Posted Thursday at 04:55 PM Author Posted Thursday at 04:55 PM 20 hours ago, monollonom said: Do you mean your LazyCron hook is not triggered? Maybe I'm not doing it right.... $this->addHookAfter('LazyCron::every5Minutes', function(HookEvent $event) { PageRender::renderPage(bfd_mailer_cron.php); echo "mailer sent"; }; On the other hand, I'm trying with an OVH cron job. As soon as I enter this on the mailer page $features = $pages->find('parent=/events/|/the-eyes/, bfd_day.name=$todayday, bfd_month.name=$todaymonth'); the job doesn't work. I presume it doesn't understand the ProcessWire api.... And then I'm not sure if this is the right way to do what I actually want, sending a ProcessWire page once a day at 10am to one or several email adresses. It used to work with a OVH cron job for years but I guess there's been a few changes between PHP 5 and 8.2 that are in the way.
monollonom Posted Friday at 01:05 PM Posted Friday at 01:05 PM 19 hours ago, BFD Calendar said: I presume it doesn't understand the ProcessWire api.... If your CRON is directly calling your template’s php file then yes it won’t work because ProcessWire isn’t bootstrapped. For a client I’m also using a CRON job that calls: "wget -qO /dev/null https://myclient.com/path/to/page". It basically triggers a GET request and thus renders a page with my script in it (it also sends an email). But it seems OVH only allow to execute a php script so maybe you should look into bootstrapping PW, something like: <?php namespace ProcessWire; include("/path/to/your/pw/installation/index.php"); $pages->get("/your/mailer/")->renderPage(); Regarding your LazyCron PageRender::renderPage is not a static function so it wouldn’t work this way, you should instead do something like: <?php namespace ProcessWire; // in your init.php or ready.php $wire->addHookAfter('LazyCron::everyDay', function(HookEvent $event) { $event->wire()->pages->get("/your/mailer")->renderPage(); $event->log("mailer sent"); }; I’m only surprised by this, maybe they changed something in the meantime... 20 hours ago, BFD Calendar said: It used to work with a OVH cron job for years but I guess there's been a few changes between PHP 5 and 8.2 that are in the way.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now