Thursday, December 24, 2015

Installing PHPMyAdmin for Azure WebApp using Site Control Manager (Kudu)


This tutorial shows you how to setup a PHPMyAdmin site in an Azure WebApp using Site Control Manager (KUDU Console)
When you are done with this tutorial, you’ll have a PHPMyAdmin site setup along with your Azure WebApp and connected with your MySql deployment (ClearDB as well as VM based MySQL).
Most PHP Developers are accustomed to use PHPMyAdmin tool to manage their MySQL workloads, for reasons like A-it comes in very handy and you can practically do everything related to your mysql databases right from within this web based console.
PHPMyAdmin can be downloaded from http://phpmyadmin.net/ , but soon as the developers start working with the Azure WebApps they get confused as to if they should install their web app code or the phpmyadmin, or should phpmyadmin be a separate website altogether?
Well !  Azure has an answer – and that is – PHPMyAdmin is an extension and the extensions can live separate from your website code, and for installing an extension as mundane as PHPMyAdmin you don’t need to download or upload anything because Azure understands that its quite a very genuine thing to ask for when you are running a PHP + MySQL workload.
The installation of extensions such as PHPMyAdmin can be done using Site Control Manager (Kudu), SCM or Kudu is a dashboard application that is available for all your Azure Web Apps, to browse this dashboard just browse to https://{sitename}.scm.azurewebsites.net (that is add scm in front of your website name), you’ll be asked for credentials and those will be the same as your deployment credentials. If you haven’t setup your deployment credentials then take a look at this article and see how to https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/ .


Setting up PHPMyAdmin extension using SCM (Kudu)

 
1. Browse to the Site Control Manager (Kudu) for your web app – https://{sitename}.scm.azurewebsites.net  


2. Click “Site Extensions” -> then Click on “Gallery” , Search for ‘PHPMyAdmin’

3. Click on the “PLUS” Sign and it’ll do an install for you, then click on “Restart Site” Button at the top Right.
4. By now the PHPMyAdmin is installed and the site has been restarted.

Configuring the PHPMyAdmin to connect with MySQL

1. In the Kudu Console, Click on “Debug Console” à CMD


2. Click on Folder “Site Extensions” , then click on Folder “PhpMyAdmin” – the presence of this folder confirms that the phpmyadmin is indeed installed.
3. Scroll down the folder/file listing and find the file “Config.inc.php” – Click on the “Edit” Button with the “Pencil” Sign.

4. This should open and Edit Window, Find the section with configuration for     $cfg['Servers'][$i]['host'] and $cfg['Servers'][$i]['AllowNoPassword'], set the “host” as the IP address of your MySQL installation (Put it as Localhost if the MySQL is in the same machine), and set AllowNoPassword to False, and Hit Save.

5. Go Back to “Site Extensions” and Click the button “Restart Site” on top Right.
6. Once the Site is Restarted browse to https://{sitename}.scm.azurewebsites.net/phpmyadmin/index.php , and Login using the “Username” of your MySQL Server and its password, and Voila! You have your PHPMyAdmin site working for you.



Interesting reads

1 comment:

Choco moments said...

Hi, I followed your instructions and I got " The *****.scm.azurewebsites.net page isn’t working. *****.scm.azurewebsites.net is currently unable to handle this request. HTTP Error 500". Do you know how to fix this? Thank you so much!

There was an error in this gadget