Updating to WordPress 4.2.2 on Azure App Service

This post is going to be relatively short, but I’ll update it with more information as I receive more feedback from users.

File System Issues

Recently there were some changes made in WinCache (v1.3.7.4) which reroutes file system calls such as is_dir, is_filefile_exists to a manifest in Wincache. This means that there is a potential for files that have been deleted on disk, to report as still available. This causes issues when updating WordPress, themes or plugins from a PHP script (such as the one used by the internal WordPress update tool). To remove these redirects follow the instructions below:

  1. Create a file called .user.ini (provided it doesn’t already exist)
  2. Append wincache.reroute_enabled=0 to the end of the file
  3. Upload the .user.ini file to the d:\home\site\wwwroot directory

This will remove any file system based errors which may occur during the update.

Database Issues

If you are running a giant WordPress blog on Azure App Service, there is the possibility that the database updates will take longer than the request timeout time. This will cause HTTP 5xx error messages when you are attempting to update.

Enabling WP CLI in Azure Websites

WordPress is the most popular CMS on the Web so there are obviously a great set of tools surrounding it to enable the wide variety of developers who build on the WordPress platform. One of such tools is WP CLI which is a command line interface for managing your WordPress site. In this post, I’m going to cover how to install the WP CLI site extension into your Azure Websites hosted WordPress install to enable command line access to your site.

Steps

  1. Install WordPress on Azure
  2. Install WP CLI Site Extension
  3. Command line to WordPress

Install WordPress on Azure

This step is a little bit out of scope for this topic, if you’re savvy enough to know there is a command line tool for WordPress, I’d assume you’d know how it set it up. If for some reason you don’t know, I’m just going to leave these here:

Install WP CLI Site Extension

To add a site extension, you need to login to the Azure Portal and go into your site.

image

If you scroll to the bottom of the site blade, you will find a part called Extensions which on that which will open the Site Extensions blade.

image

Scroll down the list until you find WordPress CLI, click on the item, then accept the license terms. Click OK and the site will begin to install the extension.

Command line to WordPress

Ok great, I have the Site Extension installed but how does that help me? I want to use the command line. There are two different command lines that I want to show off.

Kudu – Debug Console (Web Based)

When you create an Azure Website in the background a second site is created at http://<site-name>.scm.azurewebsites.net which exposes the Kudu Console (Kudu is the deployment engine for Azure Websites). You can access this site using either OAuth (which is enabled by default) or Basic Auth (http://<site-name>.scm.azurewebsites.net/basicauth). It’s cool that you have web based access to your website.

image

KuduExec (Terminal, PowerShell, Command Prompt)

Although it is really cool to be able to use the command line in a web browser, wouldn’t it be nice to be able to use your command line of choice? Well, the team thought so too, and enabled it using Node.js. KuduExec is a command line tool which gives you command line access to your Azure Website.

Screen Shot 2015-01-22 at 2.43.38 PM

To install KuduExec, first you’ll need to install Node. Once you have node and npm installed run the following command.

npm install kuduexec –g

After kuduexec installs you can run it from the command line to login. To use KuduExec, type in kuduexec then the scm endpoint for your site (hint: http://<site-name>.scm.azurewebsites.net) then use your deployment credentials to login.

Then you have full access to your Azure Websites site.

Enjoy!