WebMatrix 2: Available at a Web Platform Installer Near You

WebMatrix v2  hits the shelves yesterday so run out and download it now!. There are many additions to WebMatrix in this launch and I would like to take the time to describe a few of the things that may shock and excite you.

If you aren’t familiar with WebMatrix here is a quick blurb from the product page:

WebMatrix is a free and lightweight web development tool.
Create, publish, and maintain your website with ease.

What is new in WebMatrix 2?

It’s incredible how many features they can plug into WebMatrix and still have it be very lightweight and simple to use. Let’s take a look at some of the newly supported features of WebMatrix 2.

Intelli-Sense & Syntax Highlighting

Ok, so this might not necessarily be *new* to WebMatrix, but it has definitely been expanded. Many of you may be asking, what the $#@! is Intelli-sense? Intelli-sense is autocomplete on steriods, not only does it list the options for what you are currently typing, but it provides information around if what you’re typing is a method, constant or other variable type, it will also provide you with the method signature or additional information about the particular item you have selected in the list. There is intelli-sense and syntax highlighting support for the following languages/frameworks:

  • HTML5
  • CSS3
  • Node.js
  • PHP
  • Javascript
    • WordPress
    • Joomla!
    • Drupal
    • LESS
    • SASS
    • jQuery Mobile

    Yeah, WordPress, Drupal and Joomla! support, WebMatrix is making it easier to extend your favourite Open Source CMS by providing a quick reference to the built in methods of these framework applications.

    Community Oriented

    Now for something everyone can enjoy!

    Web Gallery

    Install a wide variety of Open Source projects directly from the Web Gallery including WordPress, Joomla!, Drupal and phpBB. New items are added to this list on a regular basis, so it could also be a great tool to discover new Open Source Projects.


    Extension Gallery

    Another cool community aspect of WebMatrix is the extension gallery, which allows you to build custom extensions to WebMatrix. The extension gallery is already chalked full of great extensions including Git for WebMatrix, iPhone, iPad & Windows Phone Simulator.

    Mobile Friendly

    Mobile is all the rage right now, so having a tool not only helps you test on mobile device emulators, but actually gets you started with Mobile Friendly Templates and has auto completion for jQuery mobile, it’s like a match made in heaven.

    Cloud Friendly

    Last but definitely not least, the one thing you most likely come to my blog for, THE CLOUD! WebMatrix allows you to deploy to Windows Azure right out of the box. Of course this isn’t the only deployment option, but quite frankly, it’s the only deployment option I’ll be using. Within a few steps you can be publishing an existing site from your hard drive to Windows Azure Web Sites, or pull down that WordPress site you installed using the Windows Azure Gallery for a few quick changes.

    To Learn more about the cloud features, read Announcing WebMatrix 2 by Jonathan Guerin.

    Accessing App Settings Configured in Microsoft Azure Web Sites using PHP and Node.js

    When developing for Microsoft Azure Web Sites, you will undoubtedly come across the CONFIGURE tab in the Azure Management Portal. Within the CONFIGURE tab you will find a section labeled ‘app settings’, in ASP.NET Development, app settings are name-value pairs typically found in the web.config file.

    Setting the variables is very simple, follow these steps:

    1. Login to the Azure Management Portal.
    2. Click on Web Sites in the left navigation.
    3. Select a Web Site from the list.
    4. Click on CONFIGURE.
    5. Scroll down to app settings.
    6. Provide a key and value.


    How do I access App Settings using PHP or Node.js

    App Settings set in the Management Portal take priority over the <appsettings> which are set in the web.config file, interestingly enough, the settings are not overwritten. This will most likely pose the question, how do I access these settings from other open source languages that don’t have the notion of a web.config file?

    These settings from the App Settings section are conveniently place in the OS Environment Variables which makes them simple to read from other programming languages. I know what you’re thinking, aren’t there a number of really important pieces of information in Environment Variables that could get overwritten?

    Technically, Yes.

    However, the Microsoft Azure Web Sites team has thought of that and exposes error messages when attempting to overwrite important System Variables.



    Accessing Environment Variables using PHP

    There are two ways to access Environment Variables in PHP, however only one of them is enabled within Microsoft Azure Web Sites.

    • $_ENV – Not Supported on Microsoft Azure Web Sites.
    • getenv() – Supported on Microsoft Azure Web Sites

    Accessing Environment Variables using Node.js

    In node.js the process object contains a property env which exposes the Environment Variables. Calling process.env and providing the key of the Environment Variable you wish to access using dot notation will retrieve the value.

    Supporting Node.js Files

    Trying Out the Samples

    If you wish to download the code from the Gists and run these samples it is possible. Uploading both to the same Microsoft Azure Web Site will only allow you to access one as the default document. The Node.js app is going to take priority. In order to view the PHP sample, simply access the index.html page directly [http://you-sub-domain.azurewebsites.net/index.php].

    If you currently don’t have a Microsoft Azure Subscription, Try Microsoft Azure Today.

    Happy Clouding!