Cant make the scheduling worker working

i want to schedule tasks with version 9.1, php 8.1

so i try to add a crontab line like

          • /path/to/public/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1

only, my hosting only allows php scripts to add in crontab. Therefore i create a script worker.php and every minute crontab calls https:// mysite /worker.php

in worker.php i have these lines

<?php exec("/usr/bin/php /pathto/ concrete:scheduler:run 2>&1", $out, $result); echo "Returncode: " .$result ."< br >"; echo "Ausgabe des Scripts: " ."< br >"; echo "< pre >"; print_r($out); ?>

$result gives 255, $out gives an empty array
no tasks are performed.

What could i do better? Any help would be appreciated.

Welcome! :vulcan_salute:

From the top of concrete/bin/concrete:

#!/usr/bin/env php

So, it is a PHP script. You should be able to run it every minute with the following crontab entry:

# minute hour month-day year-day week-day path-to-php php-script arguments
1 * * * * /usr/bin/php /pathto/ concrete:sceduler:run >> /dev/null 2>&1

Make sure that PHP is version 8+ - Let us know how it turns out…

my hosting requires crontab to call the scripts with http or https,
like https:// mysite /worker.php

I can NOT add the line as described in Automation Settings and in your answer.

If that happened to me, I would start looking for a new hosting provider.

That being said, what does your actual crontab entry look like trying to call your worker.php script?

It must be using wget, curl or the like. Of course, replace your actual host with :wink:

Did you try the crontab entry I posted?

i do not have direct access to crontab. I configure crontab to run every minute and call
https: // mysite /worker.php

remove the blanks etc :slight_smile:

my initial post tells the contents of worker.php

i use concrete 9.1 with php 8.1

That just not how scripts work. A browser, or url-transfer tool (like wget or curl) would be needed to “speak” the HTTPS protocol.

The concrete/bin/concrete script works because it is being called from the command line, invoking the PHP interpreter. It’s not using a network protocol.

How are you “configuring crontab” to “call” your script? Some sort of stripped-down control panel (that only allows PHP scripts without arguments)?

Try adding this immediately following the opening <?php tag at the top of your script, and visiting the URL in your browser:

<?php // 
ini_set('display_errors', '1');  ini_set('display_startup_errors', '1');

FYI - In many (shared) hosting environments, exec() is not allowed in PHP scripts.

If the above doesn’t give you any errors (and you are checking the return value from exec(), then you will probably need to talk to their support.

no errors showed up.
just fyi, it has to be ini_set(‘display_startup_errors’, ‘1’);

I checked with my hosting support, and they fixed it. It seemed their default php version was wrong. I explicitly used the correct php version in the script, and everything worked fine.

Oops, I typed that by hand - corrected the code block above.

In my first reply I mentioned checking that PHP 8+ was being used :thinking:

Glad you got it sorted.