Cron Error WHMCS

Hello! All good?

A few days ago I migrated my WHMCS to CyberPanel, Cron was running normally after the migration, but out of nowhere it started to crash today. The short interval Cron (5 minutes) that I programmed runs normally, the problem is the 24 hour daily task Cron that doesn’t run. I tried to run from the command line with root user following WHMCS instructions and it also runs. What can it be??

Thank you all!

Happy New Year @contatobetopaulino

All cronjobs are here /var/spool/cron/crontabs you can always view your conrjobs by running crontab -l

Identify the cron and add it this way 7 - Cron Jobs

Hello @josephgodwinke
Happy New Year to you too!
Thank you very much!

I tried the command through Cron Jobs from CyberPanel like in the tutorial and it didn’t work, now the 5 minutes Cron stopped running. I put the command: echo “CyberPanel” > /home/my-domain.com/public_html/crons/cron.php

The command I use is this: /usr/local/lsws/lsphp74/bin/php -q /home/my-domain.com/public_html/crons/cron.php
It runs every 5 minutes normally as I programmed it, but the 24 hour one doesn’t run.

In the WHMCS solutions tips they say to test by command line like this: php -q /home/my-domain.com/public_html/crons/cron.php all -F -vvv
When testing from the command line, it hangs and doesn’t run. PHP 7.4 memory is right at 512M and runtime is all right, I put 300. So I don’t know what it could be.
It must be something in CyberPanel, I use another panel and it was working fine, I have now migrated my WHMCS to CyberPanel, because I really like this panel.

See what WHMCS says about cron errors: Advanced Cron Troubleshooting | Cron & Automation | Guides & Tutorials

Glad the tutorial helped you. You should read this to implement the 24hr cron job Resolving a Daily Cron Run Warning | Cron & Automation | Guides & Tutorials

Hello! Unfortunately I couldn’t, even through their tutorial the problem continues, it didn’t work, it really is some configuration in CyberPanel. Because I used Cron on the other panel and had no problems running Cron from WHMCS. What could it be? Thanks!

Copy that cronjob and paste it here /var/spool/cron/crontabs/root at the end in the format:

# runs at 00.23 every day
23 0 * * *  /usr/local/lsws/lsphp73/bin/lsphp /home/mydomain.com/public_html/whmcs/crons/cron.php

But you also need to test it like this

 /usr/local/lsws/lsphp73/bin/lsphp  -q /home/mydomain.com/public_html/whmcs/crons/cron.php all -F -vvv

Learn more here Advanced Cron Troubleshooting | Cron & Automation | Guides & Tutorials

Hello! Thank you for your help!

I tried and couldn’t run the daily Cron, the 5 minute cron runs but the daily from the command line or the panel continues with error in the tests here. I had this problem once on the CWP panel, but I solved it by increasing the PHP.ini memory, following the WHMCS docs. Here in my CyberPanel I already increased the memory limit in PHP version 7.4 that is running the WHMCS installation. But the symptom is of the same problem I’ve had before on the other CWP panel. Is there somewhere I can confirm that the PHP memory limit has been successfully changed? Because through CyberPanel it shows that it was changed, but I’m having doubts if it was really changed.

Thanks a lot in advance for your help!

Are you using the default php or another php version ? You need to confirm which php version you changed its values. Of course you can see all the values through terminal or creating a php file that returns all the modules and their values.

Hello!
I’m using PHP 7.4. Ubuntu 22.04.2 LTS.

I was able to see it in /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini

and the memory that I changed is right, I put 1024M, but is there any other detail that I don’t know about? Or is it something in the CyberPanel that has some restriction or configuration and therefore ends up not running the daily Cron completely?
Because the WHMCS says that with the 5-minute Cron the system does the daily Cron, so the WHMCS already has the function in itself to run the daily Cron, because it has a place that I leave scheduled.

I already had this problem in CWP and cPanel and I solved it just by increasing the PHP.ini memory of the PHP version used. But here at CyberPanel I already changed the PHP.ini memory to 1024.

Thanks!

But usually by command line through root ssh access I would be able to run daily cron with the command recommended by WHMCS that forces it to run: php -q /home/yourdomain.com/public_html/whmcs/crons/cron.php all -F - vvv

But the command crashes right at the beginning and does not even run from the command line through root access through PuTTY.

Kindly do not ignore my advice. You are clearly doing your own steps.

I tried unfortunately it didn’t work, it hangs at the beginning and doesn’t run. In the attached image (image from the WHMCS documents) when we need to force Cron by ssh command, it runs successfully, just like in the image. But here when trying it hangs right at the beginning when the system tries to execute the first 3 tasks, then it gets stuck on this screen and does not run completely.

Thanks again for trying to help me.

What did you try ?

/usr/local/lsws/lsphp73/bin/lsphp  -q /home/mydomain.com/public_html/whmcs/crons/cron.php all -F -vvv

I tried with this command: ```
/usr/local/lsws/lsphp73/bin/lsphp -q /home/mydomain.com/public_html/whmcs/crons/cron.php all -F -vvv

You are meant to change the first part to your preferred php version

e.g.

/usr/local/lsws/lsphp80/bin/lsphp

Yes, I changed it, put PHP 7.4 and pointed to the WHMCS Crons path on my server,
I ran the command like this: /usr/local/lsws/lsphp74/bin/lsphp -q /home/mydomain.com/public_html/whmcs/crons/cron.php all -F -vvv

I found an option to leave it configured in the CyberPanel cron job like this: /usr/bin/curl https://seudominio.com/crons/cron.php >/dev/null 2>&1

I’m going to leave this cron command active for about 2 days to see if the system can run the daily cron successfully. Does this command have much difference with the others I was trying?

Instead of using php you are using curl for this cronjob. You can run it every minute as a test. Have you tried running it manually in ssh terminal to see if it works ? By the way this has no sink so do not expect to see any errors

How can I run it? Is there any add-on that I have to put to run manually in the ssh terminal?

Open putty or whichever ssh terminal client you are using and just copy paste the command and press enter