Category: OSS

WordPress Troubleshooting Techniques on Azure Websites

WordPress is one of the popular Web Application that is offered with Azure Websites Gallery to build dynamic websites. You may run into some issues with your WordPress websites and might want to trouble shoot them. Here are some common issues discussed below with techniques to resolve them:

How I update PHP INI configuration for my WordPress site?

Your WordPress site may require specific changes to PHP.INI based on requirements for your application such as allowing users to upload a file up to 12 MB which is higher than the default limit 8MB .

You can enable a user-defined PHP configuration, by creating a file called .user.ini at the site root (D:\home\site\wwwroot folder) and add the following

upload_max_filesize = 12M

Now restart your website. To verify if your changes were overwritten, create a PHP file called phpinfo.php with the following text and save it in the site root folder.

<?php phpinfo(); ?>

Now browse this file and search for upload_max_size


My Media content (uploads folder) is 10GB in size and my Web Application is 1GB in size. Which Tier will give me ample storage ?

The Storage supported for Shared is 1 GB, Basic is 10GB and Standard is 50GB. If you want to make the most if your website storage , move all you media content in the uploads folder to Azure Storage (which costs $0.048 per GB) and use a Azure Storage plugin to manage media content in your WordPress site.
This allows you to isolate your media content from your Web Application.

You can also create a Azure CDN endpoint for the Azure Storage account you used to serve your media content. In the plugin settings page you’ll see a CNAME property setting , where you need to enter the Azure CDN name for example

How to setup SSL for my WordPress site

Only Standard and Basic Tiers offer SSL support. To add SSL support to your website :

Can I use mod-rewrite on Azure Websites?

Azure Websites uses IIS web server and hence does not work with mod_rewrite which is an Apache module. Url Rewrite module is enabled by default on Azure websites and you can create your rewrite or redirect rules using a web.config.

Open the Web.config file located at the site root (D:\home\site\wwwroot). If you do not have a Web.config file in the directory, create it.

Copy and paste the following XML section into the system.webServer element:

<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<action type="Rewrite" url="index.php" />

This rule matches any requested URL; if the URL does not correspond to a file or a folder on a file system, then the rule rewrites the URL to Index.php and determines which content to serve based on the REQUEST_URI server variable that contains the original URL before it was modified by the rule.

To learn more about creating URL rewrite rules ,see 10 URL rewriting Tips and Tricks

How to resolve 404.3 “Mime Type missing” errors when dependent requests on .woff files ?

.woff extension is not enabled by default on Azure Websites. If you are using WordPress or any application that uses .woff files, include a web.config file at the site root folder and add the following under <system.webServer> section

   <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />     </staticContent>

Now restart your website.

How to resolve slow page load time for WordPress site running on Azure ?

If your WordPress site is slow then check for these:

  • Are you running on Free Tier?

If yes, then Free tier is not sufficient for running a production site and hence you need to upgrade to Shared, Basic or Standard Tier. Check out the features supported for each tier and select the appropriate Tier, Azure Websites Pricing per tier.

  • Is your website and database in the same data center?

If your website is setup in say West US and your database is setup in say East US ; then this can impact performance of the website as both these components are in different datacenters and network latency for the database calls can add to your page load time. Make sure your website and database are in the same regions/data centers.

  • Are your using a Free ClearDB MySQL database?

The Free ClearDB MySQL database is not production website. Check out the ClearDB plans for Azure and How to purchase it from the Store.

How to get diagnostics for PHP errors?

Websites allows you to turn on Webserver diagnostics such as Web Server logging, Detailed Error messages and Failed Request Tracing. To learn more about getting error information, see PHP diagnostics for Azure Websites

Our new Diagnostics as a Service (DaaS for short), attempts to interpret these logs in a way that it either helps me resolve the issue or provides prescriptive guidance. To learn more, DaaS – Diagnostics as a Service for Azure Web Sites

How to enable advanced WordPress Debugging?

WordPress provides various options to debug your WordPress site. WordPress uses a constant WP_DEBUG to turn ON debugging for your WordPress site. By default it is turned OFF in wp-config.php file

define('WP_DEBUG', false);

To enable it, you need to set it to TRUE

define('WP_DEBUG', true);

Note that debugging should be turned be turned OFF after debugging an issue. For more advanced options for debugging WordPress, see Debugging in WordPress.

How do I enabled Email service with my WordPress site

Azure Websites does not support Email/SMTP and hence you would need to purchase SendGrid from the Azure Store. SendGrid offers a Free plan (up to 25,000 emails per month) which might be sufficient for your WordPress site. You can learn about SendGrid Plans for Azure here if the Free plan does not meet your needs.

To learn more, How to Use SendGrid Email Service.

How do I backup and restore WordPress site

Azure Websites offers automatic Backup and Restore feature. To learn more check out How to back up your Azure Website and How to restore your Azure Website.

Can I edit my WordPress site online?

Websites comes with an online editor with the goodness of Visual Studio. To learn more, see Edit Azure Website online with Monaco.

How to Fix the Error Establishing a Database Connection in WordPress?

You get this error when WordPress is unable to establish a database connection. The following reasons could be the reason why the issue occurs:

  • Database information in wp-config.php file may be incorrect

Use MySQL Client to access your database with the information in wp-config.php to verify this.

  • Check if both the front end and back end of your WordPress site are returning the different errors

If you are getting a different error on the wp-admin page for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database. To do this add the following wp-config.php file:

define('WP_ALLOW_REPAIR', true);

Once you have done that, you can see the settings by visiting this page:

The user does not need to be logged in to access this functionality when this define is set. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.

  • wp-config.php file may be corrupted

Retouch wp-config.php file so that the last modified time stamp for the file is changed.

  • If this error occurs intermittently when your site is on high user load

Use Persistent connections with WordPress by editing wp-includes/wp-db.php file as shown below:

For WordPress with PHP version <=5.4

//remove line 1147
//$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
//Add the line below

$this->dbh = mysql_pconnect( $this->dbhost, $this->dbuser, $this->dbpassword,  $client_flags );
if ( false !== $error_reporting ) {
error_reporting( $error_reporting );
} else {
//remove line 1152
//$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
//Add the line below
$this->dbh = @mysql_pconnect( $this->dbhost, $this->dbuser, $this->dbpassword,  $client_flags );

For WordPress 3.9.1 with PHP >=5.5

//Line 1378
if ( WP_DEBUG ) {
     //Add prefix 'p:' to $host
     mysqli_real_connect( $this->dbh, 'p:'.$host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
      else {
      //Add prefix 'p:' to $host
     @mysqli_real_connect( $this->dbh, 'p:'.$host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );

Note that if WordPress Automatic are ON, this file can be overwritten and your changes can be lost. I would recommend to use a WebJob that can watch if the file was modified and make these changes if they don’t exist in wp-db.php file

  • Check if your Website Service is able to connect to the database

To verify if you can connect to the database, create a new file called testdbconnection.php and paste the following code in it:

//Modify the hostname, user, password for mysql_connect with the your
//database connection information
$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
echo 'Connected successfully';

Run this page in the browser .If you see “Connected successfully” message than Website service can connect to the database. If you see “Could not connect” message than read the MySQL error to identify the cause of the issue. Contact Azure Support if you still see “Could not connect” message and unable to resolve it.

How to resolve the error “1203 SQLSTATE: 42000 (ER_TOO_MANY_USER_CONNECTIONS)”?

If you are using ClearDB MySQL database, it has limitations on max_user_connections for the database based on the database plan you are using. Check out the details here. When you hit the limit you will run into this error, so to resolve this upgrade your database plan.

If you are using MySQL Azure VM to host your database for your WordPress site, then edit my.ini (on Windows Machine) or my.cnf (Linux Machine) configuration

max_connections = 250

Setting the max_connections too high will cause MySQL server to crash with an “Out of memory” error. Choose this value carefully depending on the RAM for your MySQL server VM.

How to resolve White Screen/Blank page?

If you see a White Screen or a blank page when you access your website, the cause could either be plugin or theme related issue. Try to isolate the theme or plugin causing this issue. Check out the step by step guide here.

How to resolve Memory Size Exhausted error ?

The default limit is 128MB. You can increase the Memory limit either using

  • by adding this to wp-config.php:
    define('WP_MEMORY_LIMIT', '128M');
  • by adding .user.ini at the site root (D:\home\site\wwwroot) with:

    Restart your websites.

Related Links

WordPress Troubleshooting Guide
WordPress Support


10 Ways to Speed up your WordPress site on Azure websites

WordPress needs no introduction and is the fastest growing Open source CMS solution which allows you to quickly create dynamic website. The more plugins, content and customizations you add to your WordPress site, can start slowing your WordPress site. Slow page load times can impact your target user audience and discourage them from visiting your website again. A lot of search engines consider page load times as well when ranking results and can impact the visibility of your website on their search engine results. If you are running your WordPress website on Azure Websites and want to optimize it to obtain fast page load time, then consider implementing these quick and easy steps mentioned below to speed up your WordPress site.


When running your WordPress site on Azure Websites, make sure your database and website are in the same datacenter. Network latency can increase the page load time for your site if the website needs to go around the world to make a call to the database. Keeping the site and database components in the same datacenter will reduce the network latency and improve the page load time for your website.


If you are developing the site, you can use the Free MYSQL database that come with WordPress install from the Websites Application Gallery. But this is not ideal for a production level site. The FREE database has:

  • Max 20MB storage for Database
  • Allows up to 4 connections ( max_connections)
  • Low performance

We recommend to use to a database that can handle your estimated user traffic from the various other options supported by ClearDB as seen here. To learn how to provision a database using Clear DB from Azure Store, click here. If ClearDB database option does not meet your needs, you can always setup an Azure VM running MySQL and use that server for your database. To learn how to install MySQL on an Azure VM, click here.


WordPress auto-saves everything but the disadvantage with this is that your database gets filled with a lot of post revisions, trackbacks, pingback, comments and trash items quickly which needs to be cleaned up manually on a regular basis. With the database plan you are using with your Website there will be limitation to the storage size allocated to your database and you may hit this limit as well if the database is not cleaned up regularly.

WP-Optimize is a great plugin which allows you to routinely clean up your database making the database more efficient and filled only with what needs to be kept. It saves you a lot of time without doing manual queries to optimize and clean up your database. Continue reading “10 Ways to Speed up your WordPress site on Azure websites”

BugNET on Windows Azure Websites

If you are looking for a cloud based solution for Project Management and bug tracking, then you should give BugNET a try. BugNET is now available on Windows Azure Websites Gallery and can be set up in just a few minutes. This is an Open source licensed version of BugNET written in ASP.NET that allows you to:

  • Create Unlimited projects
  • Track bug & Issue for your projects
  • Track the status of your project
  • Integrate with Gravatar, Source control (SVN, Mercurial), Open ID etc.

To learn more about the features, check this article.

Continue reading “BugNET on Windows Azure Websites”

Run Analytics on your Windows Azure WebSite – Part I

Web Analytics is basically measuring and collecting information about your Web Site usage  that helps you understand

  •  user/customer behavior
  • track traffic to your website
  • analyze marketing campaigns and conversion rates

There are many Open source applications that  give you a great view to your website usage through reports of various kinds of information about your WebSite .  Here are two apps that are popular  : Piwik and Open Web Analytics .

In part I of this tutorial you will learn how to set up your Piwik application .  In part II of the tutorial you will learn  the steps required to  setup your web site to allow the Piwik application to collect the data.

How to setup Piwik application

Piwik is available on github : . You can create a fork of the application if your have a github account or download the application in a ZIP format .

Once you have the content for Piwik application  , the next step is to log in to the Azure Management Portal and create a new website with a MySQL database as shown here

  • Select New –> WebSite  –> Custom Create
  • Enter the site name , select a region and  select  ” Create new MySQL database”



Using GIT , you can publish Piwik to this newly created Windows Azure website  . You can refer this article on how to publish from github or  local GIT repository.

Once PIWIK application content in published to your azure website , click on browse and PIWIK Web Installer will show up .  Before we continue with the PIWIK installer , keep a note of the connection string for the MySQL database as this will be needed .


Now complete the steps as shown below :



Enter the database information



Enter the site admin username and password


Enter the site name , url and timezone  against which you wish to collect web analytic  data .



Keep a note of the script mention in the above screenshot . This script needs to embedded in every web page  in order for PIWIK application to start collecting data .


That’s it , Piwik is now configured . Lets see the next steps to get you website integrated with Piwik in Part II of this tutorial .