Posted on

WordPress on Azure: Error establishing a database connection

You have a WordPress site hosted on Microsoft Azure.Perhaps your site is part of a free or shared app service plan.

Trying to connect to the site, one day, you have this wordpress error message:  Error establishing a database connection

How to find out and solve the problem?

Connecting  to Microsoft Azure Service with FTP

First of all you have to connect to the site via ftp to understand where the error is. We can connect to Azure web application with FTP also. In the Overview section of the your Azure web application, select “Get publish profile”. It will download a file that has a lot of things and teh details about FTP username and password, which is constant and can be used for FTP connection.

Enable WordPress Debug Logging

You need FTP connection to  enable WordPress Debug Logging. To enable error logging in WordPress, you will have to make both of the following changes :

  1. In wwwroot directory, create a file named .user.ini Add the following line:log_errors=on
  2. In wwwroot directory, open wp-config.php
    Add the following lines  :

//Enable WP_DEBUG mode
define('WP_DEBUG', true);

//Enable Debug Logging to /wp-content/debug.log
define('WP_DEBUG_LOG', true);

//Supress errors and warnings to screen
define('WP_DEBUG_DISPLAY', false);

//Supress PHP errors to screen
ini_set('display_errors', 0);

Also comment the line :

    /* define('WP_DEBUG', false); */

Analyze the Log File

Try to load your site. Now, through ftp, you can enter in the directoy LogFiles and analyze the file

php_errors.log

Database error

Perhaps you have a database error, for example a duplicate key problem. On azure, in your app service, select Mysql In -app button. On the top of the section, you can see the Manage button. Click on the button and you’ll load the phpMyAdmin portal on your local Mysql DB.

Duplicate entry

If you have this kind of error : Duplicate entry ‘XXXXX’ for key ‘PRIMARY’ for the  query INSERT INTO `table_name`, just ran following command :

REPAIR TABLE table_name

That’s it! It was done.

Posted on Leave a comment

Azure Subscription Services Open for a new Microsoft tenant

azure

This is the procedure we followed to register a new Microsoft Azure subscription for a company that does not have a subscription to Office 365.

Visit https://account.windowsazure.com/organization to sign up for Azure with a new organization.

Enter the name and surname of the company reference.

A name for the company domain similar to xxxxx.onmicrosoft.com.

Use your email address for reference.

Enter an username, for example admin and password; company

Enter company’s vat registration number.

As part of the process of signing up for Azure, you will be required to provide credit card details. We didn’t insert it. Whenever you log in to Azure’s portal you are asked for your credit card details.

You have to bought a new Azure Subscription Services Open from the Microsoft distributor, using Company’s name, your mail address (the same used creating Azure account) and Company’s vat registration number.

Using Microsoft Edge,  enter, in Azure Portal : credit card details are no longer required. You can add the license of the new Azure Subscription Services Open. That’s all.

Posted on Leave a comment

Which operating systems do Azure Backup support?

Operating System Platform VERSION
Windows 8 64 bit Enterprise, Pro
Windows 7 64 bit Ultimate, Enterprise, Professional, Home Premium, Home Basic, Starter
Windows 8.1 64 bit Enterprise, Pro
Windows 10 64 bit Enterprise, Pro, Home
Windows Server 2016 64 bit Standard, Datacenter, Essentials
Windows Server 2012 R2 64 bit Standard, Datacenter, Foundation, Essential
Windows Server 2012 64 bit Datacenter, Foundation, Standard
Windows Storage Server 2016 64 bit Standard, Workgroup
Windows Storage Server 2012 R2 64 bit Standard, Workgroup
Windows Storage Server 2012 64 bit Standard, Workgroup
Windows Server 2008 R2 SP1, 64 bit Standard, Enterprise, Datacenter, Foundation
Windows Server 2008 SP2 64 bit Standard, Enterprise, Datacenter, Foundation

Source Microsoft