Jump to content
Sign in to follow this  

Critical Error Could not connect to the database.

Recommended Posts



I'm getting the following error : 

Critical Error

Could not connect to the database.


Here is my configuration.php file


$license = 'WHMCS-SECRET';
$db_host = '';
$db_username = 'user';
$db_password = 'SECRET';
$db_name = 'mydb';
$cc_encryption_hash = 'jdhJSH4ze47qs5AZde45d5qsd4zesde44aDgfvfzZf';
$templates_compiledir = '/var/www/template_c/';
$attachments_dir = "/var/www/html/test/att";
$downloads_dir = "/var/www/html/test/att";
$customadminpath = 'admin';
$api_access_key = 'SECRET';

I tried to connect from the server to the database using the same credentials as in the file : 


mysql -h -u user -pSECRET mydb



MySQL [mydb]>

How can I debug it ?


PHP 7.0.33

Share this post

Link to post
Share on other sites

If you are connecting with Remote MySQL make sure your Server Firewall Accepts the Connections or use Localhost for connecting in same DB on the Server

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Similar Content

    • By aperture
      I am looking for a way to determine the source of a new invoice. That being is the new invoice generated by a client action, like ordering a service. Or if it simply is generated by billing.
      Testing the InvoiceCreated hook for invoiceID gives us the new invoice number. However it is not possible to check this invoiceID against database tables. This seems to be because the invoice has yet to be finalized. Else we could have checked if the invoiceID was located in both tblorders.invoiceid and tblinvoices.id. Any match on both tables would indicate it was an order, and should there only be a match in tblinvoices.id it would be simply billing.
      Next we have the source variable, there it seems to be mainly autogen being used. I did check the classdoc for Invoice, there we have a runCreationHooks method with a String $source parameter, with 4 possible options: 'adminarea', 'api', 'autogen' or 'clientarea'. Now the whmcs hook InvoiceCreated states that the only values it will return are one of 'adminarea', 'api', 'autogen' or 'clientarea'.
      Does anyone have any tips, or have you perhaps dealt with this issue and found a way?
    • By Davor
      is there a module or a way to create a MySQL user & database automatically for the newly created cPanel account?
    • By fbarajas
      Hi everyone!
      I have the latest WHMCS version (8.1.3) running on a Cloudlinux 7 server using PHP 7.3 without any problem.
      When I try to change to PHP 7.4 using the "PHP-Selector" included on Cloudlinux, I get a "500" error on WHMCS.
      I have the following modules configured in 7.4.  Is some module missing?  Any ideas?

    • By ModulesGarden
      1. cPanel Extended For WHMCS V3.10.0

      The grand new update of cPanel Extended For WHMCS has arrived embracing a string of new possibilities raised by the freshly implemented User Manager section! With it, your customers are empowered to create additional users along with their email, FTP, and web disk sub-accounts.

      What is more, we have established support for Remote MySQL and ModSecurity. The first one permits customers to add remote host addresses that will allow visitors to connect to the MySQL databases. The second feature is responsible for protection of your clients' domains - they are free to decide whether it should be enabled or not.

      Learn more about cPanel Extended For WHMCS 3.10.0!

      2. SMS Center For WHMCS V3.7.0

      It’s common knowledge that untroubled flow of information both internal and external-wise is essential for smooth business operation. However, it is the skill of effective communication with both your teams and customers no matter the time and place that makes it truly stand out.

      Our newly released SMS Center For WHMCS 3.7.0 will offer you the choice of 7 more SMS gateways! With this prominent update, you can also bound customers to re-validate their phone numbers, access the archive of SMS messages, serve new events such as "Invoice Activation" and "Order Paid Activation", as well as make bulk status updates of the approval messages.

      Look into a more extensive account of the newly implemented changes!

      3. Hetzner VPS For WHMCS V1.4.0

      Our Hetzner VPS For WHMCS is already known to many, but after today it is very likely to win the hearts of the entire WHMCS community! This well-thought-out solution responsible for bringing automation into provisioning and management of Hetzner servers has just been bolstered up with some further optimizations.

      The 1.4.0 version introduces widely requested support for user data and floating IP addresses, as well as dynamic generation of hostname. Moreover, your clients are about to enjoy the freedom of ordering backups as an addition to the virtual machines. The richer the offer, the better!

      Eager to learn more? Look into the remaining benefits listed neatly in the module′s changelog!

      4. Over the last weeks we have also released a greal deal of WHMCS V8.0 compatibility updates:
      Amazon EC2 For WHMCS - v1.2.2 Amazon Lightsail For WHMCS - v1.1.5 Client Profile Viewer For WHMCS - v1.7.2 DigitalOcean Droplets For WHMCS - v1.6.1 Enom Email For WHMCS - v1.3.7 Hosting Renewals For WHMCS - v3.2.4 InterWorx Extended For WHMCS - v1.0.9 OpenStack VPS & Cloud For WHMCS - v1.9.3 QuickBooks Desktop For WHMCS - v1.3.4 Payment Gateway Allocator For WHMCS - v1.1.13 SolidCP Extended For WHMCS - v3.4.2  

      Need Custom Software Development For Your Business?
      Get Your Free Quote Now! Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!  
    • By Dimitra
      I recently started using the Email Marketer in order to send automatic emails to my clients about their product's next due date.
      My problem is although  I have configured everything (following the documentation) correctly but the emails are not sent.
      I have created a Demo client with one product and a Email Marketer rule to send email 1 day before the product's Next Due Date. I have configured the product to expire (next due date) tomorrow, the demo client's email is correct (I have tested it and i can send/receive emails), but I still don't get the Product Expiring email.
      Checking the logs, I found the following entries:
      Notification sending failed for Rule ID 1 - Error: No Recipients Found
      Created Invoice - Invoice ID: 123
      Automated Task: Starting Invoices
      As for the cron jobs, I have noticed the following:
      in 'Set Up -> Automation Settings, I see the message Cron Status OK, however in the System Health page, I see the error:
      The system cron does not appear to have completed successfully within the last 24 hours. Check your activity logs or learn more about enabling the cron in our documentation. 
      I don't know if the cron job messages are related to the email problem.
      System details:
      WHMCS v7.10.2
      PHP 7.3
      Any help solving  the automatic emails problem would be appreciated.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • 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