My cron job does not run automatically

Media Directory

Verified User
Joined
Aug 16, 2024
Messages
7
My cron job does not run automatically. I do not know what to do. I have included a screenshot below. My cron code is the the following:

/usr/bin/php -q /home/magazin2/domains/magazinedirectory.net/public_html/index.php cron > /dev/null 2>&1
 

Attachments

  • Screenshot 2025-02-19 at 5.38.06 PM.png
    Screenshot 2025-02-19 at 5.38.06 PM.png
    901.7 KB · Views: 28
This look like CLI using some unsupported PHP version of that billing software.

If you have multiple PHP version, ensure you using same PHP version between PHP-FPM and CLI,

since PHP-FPM is running fine, so just matching the CLI version with PHP-FPM.
 
How do I do this? I have been unable to solve it even with Blesta forum advice. I will try anything. "ensure you using same PHP version between PHP-FPM and CLI". (????)
 
"ensure you using same PHP version between PHP-FPM and CLI". (????)
Check in your settings which php you are using on your domain. Suppose you're domain is running on php 8.2 then use like this in your crontab:
/usr/local/php82/bin/php /home/magazin2/domains/magazinedirectory.net/public_html/index.php cron > /dev/null 2>&1

I thought this was done automatically but probably I'm mistaken.
 
Richard G I love your advice. I sense that i am almost solving it. Still does not work automatic. My modified URL is the following:

/usr/php82/bin/php -q /home/magazin2/domains/magazinedirectory.net/public_html/index.php cron/?cron_key=qkPQmLLb > /dev/null 2>&1

URL which Blesta gives is the following:

* * * * * /usr/bin/php -q /home/magazin2/domains/magazinedirectory.net/public_html/index.php cron > /dev/null 2>&1
I have include the DirectAdmin Snapshot and the Blesta Snapshot.
 

Attachments

  • Screenshot 2025-02-21 at 8.16.15 PM.png
    Screenshot 2025-02-21 at 8.16.15 PM.png
    848.8 KB · Views: 11
  • Screenshot 2025-02-21 at 8.16.33 PM.png
    Screenshot 2025-02-21 at 8.16.33 PM.png
    966.5 KB · Views: 11
Create an info.php file with the following code (using DirectAdmin's File Manager or FTP):
PHP:
<?php phpinfo() ?>

Then, navigate to magazinedirectory.net/info.php to check the PHP version running on your server.
As Richard already mentioned, in a default DirectAdmin setup, the PHP binary is located at:
/usr/local/phpXX/bin/php
Replace XX with the PHP version shown in info.php.

For example, if the PHP version is 8.1.31, the binary path would be:
/usr/local/php81/bin/php

If you're still experiencing issues with your cron job, try redirecting the output to a log file inside your public_html directory. You can then download and inspect the log at magazinedirectory.net/cron.log

/usr/local/phpXX/bin/php -f /home/magazin2/domains/magazinedirectory.net/public_html/index.php > /home/magazin2/domains/magazinedirectory.net/public_html/cron.log 2>&1
 
Back
Top