Foliotek Developer Blog

LiveZilla On Azure App Service

LiveZilla Azure App Service

This guide will walk you through the basics of setting up LiveZilla to run on PaaS service such as Azure App Service. In my case I had to migrate an existing LiveZilla instance running on a VM and run it on Azure App Service. This guide does require you to jump into the LiveZilla config files and update a few things. The LiveZilla version I was using was I'm not going to go into every detail of Azure / App Service you should already have some experience on this front for you to be successful setting this up.

  • MAKE SURE You Disable Slow Query Log and General Log otherwise you will max out your disk space QUOTA, this might be a an issue only because the feature is still in preview I'm not sure. See below.

LiveZilla Database Import

  • Log into your physical VM MySQL Database you will have to export 3-4 tables at a time and import them into PHPMyAdmin, the reason for this is currently Azure PHPMyAdmin has a max upload size of 8MB you cannot change this by modifying maxupload size in configs. I would recommend not zipping them as this also seems to crash PHPMyAdmin, its a little brittle Its a static setting from Azure at the writing of this article.
  • Once you have each table imported into your new LiveZilla DB in PHPMyAdmin you will now modify the connection strings.These are all Base64 encoded. This will help you view / edit the values.
  • All in all once the DB is in App Service its very fast, and a huge improvement over ClearDB (which by the way runs like a complete turd)
Parse Azure MySQL Environmental Variable

App Service Instance | Edit File: site/wwwroot/_config/ add this below line 39.

//Loop Through And Pull Settings From Azure ENV Variable
    foreach ($_SERVER as $key => $value) {
    if (strpos($key, "MYSQLCONNSTR_localdb") !== 0) {
    //Set Base 64 Version
    $_CONFIG[0]["gl_db_host"] = base64_encode(preg_replace("/^.*Data Source=(.+?);.*$/", "\\1", $value));
    $_CONFIG[0]["gl_db_name"] = base64_encode("livezilla");
    $_CONFIG[0]["gl_db_user"] = base64_encode(preg_replace("/^.*User Id=(.+?);.*$/", "\\1", $value));
    $_CONFIG[0]["gl_db_pass"] = base64_encode(preg_replace("/^.*Password=(.+?)$/", "\\1", $value));

        $connectstr_dbhost = preg_replace("/^.*Data Source=(.+?);.*$/", "\\1", $value);
        $connectstr_dbname = preg_replace("/^.*Database=(.+?);.*$/", "\\1", $value);
        $connectstr_dbusername = preg_replace("/^.*User Id=(.+?);.*$/", "\\1", $value);
        $connectstr_dbpassword = preg_replace("/^.*Password=(.+?)$/", "\\1", $value);

If you run into DB connection issues search through all the LiveZilla code and look for other places the connection string is used, replace the value with the above parsed out values, make sure you Base64 encode everything.