Jump to content

Critical Error on cron. Any idea how to fix?


paperweight

Recommended Posts

I just updated from v5 to v6 last week and I found that for the past week no cron was running. I turned on emails in cron and this is what I found today as the response:

 

<style>.genericError {
  border: 1px dashed #CC0000;
  font-family: Tahoma;
  background-color: #FBEEEB;
  padding: 10px;
  color: #CC0000;
}</style>
<div class="genericError">
  <strong>Critical Error</strong><br />
  Could not connect to the database.
</div>

 

My paths to cron are correct and I can run cron from SSH, so any idea what the database connect error means and how to fix it?

Link to comment
Share on other sites

Thanks for your help. Yes I updated already to use the new cron locations, and I placed it outside the webroot. Here's what I did:

 

1) In configuration.php in the WHMCS root I added this custom location:

$crons_dir = '/home/myname/whmcs-crons/';

 

2) Then in the config at /home/myname/whmcs-crons/config.php I poinbted back to my WHMCS path:

$whmcspath = '/home/myname/public_html/';

 

3) Then in my cPanel I have cronjobs like these set:

0	0	*	*	*	php -q /home/myname/whmcs-crons/cron.php
*/15	*	*	*	*	php -q /home/myname/whmcs-crons/pop.php >/dev/null 2>&1
*/15	*	*	*	*	php -q /home/myname/whmcs-crons/pipe.php >/dev/null 2>&1

 

Any idea what's wrong with this config?

Link to comment
Share on other sites

Ok I double-checked something else and found a possible problem. When I ran the cron via SSH before I was logged in as root, and cron ran fine. But then I swicthed user "su mywhmcsuser" and ran as "mywhmcsuser" and then I ran into this same error on SSH:

 

php -q /home/mysitename/whmcs-crons/cron.php
<style>.genericError {
   border: 1px dashed #CC0000;
   font-family: Tahoma;
   background-color: #FBEEEB;
   padding: 10px;
   color: #CC0000;
}</style>
<div class="genericError">
   <strong>Critical Error</strong><br />
   Could not connect to the database.

 

So it appears to be a permissions problem? And is the permissions problem on the db or file? Seems to be on the db, right? Is there a cPanel cron setting I missed to allow the user to run this file and access the db?

Link to comment
Share on other sites

perhaps this might help...

 

https://forums.whmcs.com/showthread.php?89699-Cron-jobs-not-working&p=377723#post377723

 

Hello, In most of the cases where we've seen this, it's due to the user that the crons run as not having access to MySQL in their shell. You can confirm this by logging into shell as the cPanel user and running the mysql command. Every time we've seen this, it was resolved by changing the cPanel user's shell to "default." If this does not resolve the issue, please submit a ticket so that we may take a closer look.

if it doesn't help, then i'd get that support ticket, with as much relevant info as possible, into support before the weekend begins.

Link to comment
Share on other sites

if it doesn't help, then i'd get that support ticket, with as much relevant info as possible, into support before the weekend begins.

 

So I have notified both cPanel and Cloudlinux of the problem. Technicians from cPanel were in the server a couple days ago and saw it was a Cloudlinux problem related to CageFS and cron. Then I went to CloudLinux and they said there is an internal known issue related to the paper_lantern theme and cron jobs in some installs, but when I checked and fixed that my probelm persisted. So now Cloudlinux technician at this moment are in the server checking things.

 

I will let you know results soon.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated