What’s the difference between these types of hosting?
On-prem AKA “on-premise” is the traditional way of hosting on-site. The storage, RAM, electricity, networking, operating system, applications, web servers… everything is managed by you. This typically involves multiple system administrators to keep the service running. Examples of these are traditional engineering organizations or development teams.
Infrastructure-as-a-service AKA IaaS is where you manage the platform, applications, and data. The infrastructure is managed for you. Example: Virtual Machines.
Platform-as-a-service is where you manage the applications and data. The platform and infrastructure is managed for you. Example: Azure App Service.
Software-as-a-service is where you manage data or content. The platform, infrastructure, and application is managed for you. Example: Managed WordPress.
Out of these four types of WordPress hosting, both IaaS and PaaS are available on Azure.
Azure has a plethora of products and can be confusing to the first-time customer. This post will cover a popular MySQL database options for WordPress when hosting on Azure.
IaaS (Virtual Machines)
MySQL on Virtual Machine
Full control of MySQL Server Multitude of VM options
Maintenance Multitude of VM options
If you enjoy/don’t mind server maintenance
PaaS (App Service)
MySQL In-App (Windows only)
Easy to enable
Free withWindows web app
Windows-only Not production-ready App cannot scale horizontally Shares resources with web app Requires additional configuration for MySQL port umber
For development or 1-instance situations
Azure Database for MySQL
Production-ready Microsoft-backed Easy to upgrade Supports app scaling
For production websites receiving constant traffic
These are the three main database options when hosting WordPress on Azure. I have tried all of them. I prefer the Azure DB for MySQL for production-ready scenarios the best. Microsoft maintains the database and you don’t have to worry about patching, security fixes, etc.
If you are on budget, MySQL In-App is great for getting started in development scenarios.
Those with DB/Admin/Webmaster experience may prefer the Virtual Machines option. They are all good and offer their advantages and disadvantages.
What about you? Which database type do you prefer on Azure for WordPress?
While getting started on Xamarin Android, I had trouble installing the app on my LG v20 phone. I kept seeing the message “App not installed” and could not figure out why? I knew my phone’s debug settings were correct. I spent some time searching online and then came to the conclusion that I needed to sign the Android application package. This is not a well-discussed problem! If this post has helped you, please leave a comment below! Thanks!
Often, performance on a website isn’t what it needs to be. One way you can improve performance is to cache files to the local disk. On Azure App Service Web Apps, an application can access the local disk at D:\local\temp. This location is specific to each instance. Due to the nature of Platform-as-a-service, this location is not easily accessible to the user. However, the application has access to this location pro-grammatically. Moreover, many popular applications and frameworks have file caching as a default feature.
PHP, a popular programming language in the Open Source community, has several MVC Frameworks that include file caching. Frameworks such as Laravel, Symfony, CodeIgniter and many others. In these frameworks, the cache location can be set to the local disk on the VM rather than the storage.
An easy way to clear this cache is to restart the App Service Web App. However, this causes your application to go offline for some time. An alternate way to clear the cache is to utilize the AppInit module within IIS. The IIS AppInit module can execute a script on a W3WP process recycle. These recycles occur on restarts, application settings updates, scaling to new instances, etc. This is not a complete list and more information can be found online.
In this article, you will learn how to execute a script through an application settings update. This is not intended to be a complete solution as your use-case may vary. It is intended to show you how the AppInit module can be used within App Service Windows.
The solution has three components:
Create an initialization page to be executed upon a recycle. This is the clear cache script.
Set the initialization page in the web.config.
Update an application setting to trigger the recycle
Here is a sample initialization page written in PHP:
<?php /***** File Location: wwwroot/appInit/maybeCacheClear.php ***** This script runs when the web app is recycled. ************************************************************** You can lock the cache in two ways so it is not cleared on a recycle: 1) add the application setting 'cacheLock' and set the value to true 2) create a file, cache.lock, within this directory ******************/
The last piece of the solution is within Application Settings. Here we will create a key named “cacheLock” with a value of “true”. This setting determines if the cache should be cleared or not. When the value is set to “true”, the cache is locked and will not be cleared. However, when set to “false” the cache is no longer locked and it will erase the cache from the local disk.
Now that web.config, cache clear script and Application Settings are in place, trigger a recycle by updating an Application Setting. If everything went well, you will see a message within cache.log. It should look like this:
That’s it! As simple as that. Once you’ve placed these components in place, you can utilize Application Initialization to clear cache from local instances. I hope this has helped your application design be more performant. Questions or comments? Please leave feedback below!
I’m running Windows Subsystem for Linux (WSL) on Windows 10. I downloaded a Git repo under the WSL mount. I noticed that whenever I used Windows/Visual Studio Code to save files, the permissions would reset to 000. I spoke with a colleague and his setup was different than mine.
I had the Git repo inside WSL mount.
His Git repo was on the Windows/C-drive mount and he had a soft-link to the repo. He did not face the permission issue.
So after I pushed out my latest changes, I decided to move my repo. This was the easy part. I made a softlink using
ln /directory/ /linkdirectory/
However, after the repo was moved and I modified one file, it was a bit unnerving to find out that ALL the files were listed as modified. I browsed around and saw that this could’ve been due to the line-endings on Linux vs. Windows.
It wasn’t until I updated these two settings that the rotten state in Denmark became a happy state:
App Service Assistant is a WordPress plugin that provides details on important settings and configuration. This can be helpful to troubleshoot WordPress issues. Information such as current theme, theme path, WP defines, plugins, php_errors.log (if enabled), debug.log (if enabled), user.ini, app settings.
Installing this plugin is a cinch! Just follow the steps below to get it activated and running in your WordPress application.
Plugins > Add new
Search for: app service assistant
How to use:
From settings menu, select “App Service Assistant”
Location of Log File – AppAssistant.html is saved in the D:\home\LogFiles directory.
WordPress Buddy+ is an Azure Web Apps Site Extension that facilitates WordPress configuration and especially useful for WordPress migrations. It has features for updating HOME and SITE_URL, viewing list of plugins and updating passwords. In addition, it can also help migrate the MySQL database, whether it be MySQL In-App, ClearDB or on a Virtual Machine (VM).
In the Azure Portal, select Web App and scroll to Development Tools section
Select Choose Extension
Scroll to find WordPress Buddy+
Confirm the Legal Terms and click OK
If you need additional help installing this or other Site Extensions, check out the article here.
Prerequisites – Connection Strings
ClearDB or MySQL Server on VM
If using ClearDB or MySQL on VM, ensure that the connection string is in place within application settings.
The format is as follows: Database=<db name>;Data Source=<host name>;User Id=<username>;Password=<password>
When using MySQL In-app, the connection string is created automatically. Ensure In-app is enabled.’
Fig 3. MySQL In-App Blade
Fig 4. WordPress Tools
When using multiple connection strings, select the appropriate database
Displays list of Active Plugins and provides an option to Disable All Plugins
Update Home and SITE_URL in WP_OPTIONS table by updating fields
Used to update passwords
Fig 5. Migration Assistant
List of databases (from connection strings)
Downloadable .SQL files on the server
Help – description of features
Import .SQL to MySQL Database
Export a MySQL Database to .SQL
Delete .SQL files listed in (2)
Fig 6. Import Menu
Select .SQL file to import
Select Database to import TO
Click to begin the import
Fig 7. Export Menu
Clicking the button will export all databases listed in connection strings