Introducing Z-Ray on Azure

      No Comments on Introducing Z-Ray on Azure

This article introduces a new and cool way to develop PHP in the cloud, with Z-Ray on Microsoft Azure.

You’ve probably already heard of Z-Ray, but just in case you haven’t – here’s a short recap.

Z-Ray is an advanced debugging and productivity tool for PHP developers that provides info on what’s going on under the hood of your apps, in your browser, and without having to change a thing in your code.  Using a feature called Z-Ray Live!, you can profile non-browser based requests coming into the server as well, such as mobile requests and APIs. In addition to generic PHP information, Z-Ray also provides detailed information for specific apps and frameworks – WordPress, Magento, Drupal, Symfony, Laravel and Zend Framework, and many more.

In this article, you’ll learn how to enable Z-Ray on your Azure web app, configure Z-Ray, use Z-Ray Live! to debug non-browser based requests and use Z-Ray in production.

Enjoy the ride!

Prerequisites

To follow the steps below, you’ll need the following:

  • An active Microsoft Azure account (get a Free Trial)
  • An existing Azure web app (here’s some information on how to set up a web app)

Step 1: Enabling Z-Ray

Your first step is to enable Z-Ray on your Azure web app.

  1. Log into the Azure portal, and select your web app.
    Your web app is opened in a separate blade.

webapp

  1. Open the Tools for your web app.
    To do this, click the Tools icon at the top of the blade.

tools

  1. In the Develop section, select Zend Z-Ray, and then Enable Z-Ray for Azure.

pricing_tier_updated

  1. Select your pricing tier, and click Select.
    The Legal Terms and Disclaimers blade is opened.

legal_terms

  1. Review the license details, and then click Purchase.
    Z-Ray is enabled and a success message is displayed in the Notifications panel.
  1. All you have to do now is open your web app (You can use the browse button on the Web App blade to open the website).
    Z-Ray is displayed at the bottom of the page.

Z-Ray on Azure Screen 7

That’s all there is to it. In just a few seconds, you can start using Z-Ray to develop your PHP apps.

Step 2: Configuring Z-Ray

Great! You’ve got Z-Ray running on your web app. This step in the tutorial will introduce you to the Z-Ray Management Dashboard. The Z-Ray Management Dashboard contains some additional features and enables you to configure Z-Ray to suit your environment and personal preferences.

  1. To open the Z-Ray Management Dashboard, click the Z-Ray Management Dashboard link in the Zend Z-Ray for Azure blade.

opening_management_dashboard1

The Z-Ray Management Dashboard is displayed.

Z-Ray on Azure Screen 9

  1. To configure Z-Ray settings, select the Settings page.
  2. To configure the way Z-Ray collects data, select the Date Collection tab. You can then decide whether to enable backtracing in Z-Ray or not, and whether you want Z-Ray to collect data for the various extensions. This tab also contains the option to set the max number of log entries displayed in the Errors & Warnings panel.
  3. Select the Privacy tab to determine whether you want Z-Ray to mask key attributes to ensure user privacy. You can also enter your own key attributes to be masked.
  4. Select the Advanced tab to configure Z-Ray advanced settings. In this tab, you can for example configure the list of function groups for filtering the functions in Z-Ray.

The full description of the settings available on the Settings page are described in the online help: http://files.zend.com/help/Z-Ray-Azure/Content/configuring_z-ray.htm

Step 3: Using Z-Ray Live!

The Z-Ray Management Dashboard contains an additional Z-Ray feature called Z-Ray Live!

Z-Ray Live! is used for real-time monitoring of all requests made to the server, including non-browser based requests, such as: APIs, web services, and mobile requests. All the information recorded and displayed in Z-Ray, such as request execution time, exceptions, errors, database queries, functions, and more, can be viewed in one centralized location.

Note: Z-Ray Live! is only supported on the Standard edition of Z-Ray for Azure.

Tracking for requests is commenced as soon as the page loads. So to use Z-Ray Live! simply open the Z-Ray Live! page in the Z-Ray Management Dashboard and wait for the requests to come pouring in!

Z-Ray on Azure Screen 10

Note: Z-Ray functionality on this page depends on the set Z-Ray access mode. In Enabled Mode – all requests made to the Web server are displayed . In Secured Mode, only requests using an access token are displayed. In Disabled Mode – all request information is not displayed.

Step 4: Using Z-Ray in Production

This step will demonstrate how Z-Ray can be used safely in production as well. The Z-Ray Secured Mode allows you to enable Z-Ray for specific IPs or URLs, and for a specific time duration, by passing an access token to the URL as a GET parameter. The token can also be restricted for specific base URLs.

  1. Open the Access Modes | Mode page in the Z-Ray Management Dashboard.
  2. Select the Secured mode, and click Save.
    When prompted, verify your selection.
    Z-Ray is now in Secured mode.
  1. Open the Tokens page, and click Create Token.
    The Create Access Token dialog is displayed.

Z-Ray on Azure Screen 11

  1. Configure the new access token:
  • Name – Enter a description for the new token for reference purposes only.
  • IP Restriction – Enter a comma-separated list of IPs representing the machines you wish to enable Z-Ray on, either as a masked range or in CIDR.
  • Example: 127.0.0.1 will limit access to just the local machine, 10.0.0.0/8 will open up access to any address that starts with 10.
  • URL Restriction (Optional) – Enter the URL of a page you wish to enable access to Z-Ray for. Note: This token setting option is not mandatory. However, leaving this field empty will allow access to Z-Ray for all pages on the server.
  • Time Restriction – Set a time limit for the access token, after which access to Z-Ray will no longer be enabled.
  1. Click Create Token.
    A token is created and added to the Tokens list.
  1. To use the token, all you have to do is add it as a GET parameter to the page URL.
    Example: http://example.com/path/page.php?zsdbt=<token-string>

Summary

Using Z-Ray on Azure will revolutionize the way you develop PHP on the cloud. The combination of Z-Ray and Azure means you can use Z-Ray to introspect any code you have deployed on an Azure web app, thus enabling you to enjoy the best of the two worlds – Azure’s web app services and Z-Ray’s powerful introspection capabilities.

We would love to receive your feedback so we can make this service even better. To provide your input, please fill this form.

For more information on how to work with Z-Ray on Azure, you can visit the online help at: http://files.zend.com/help/Z-Ray-Azure/Content/home.htm

Thanks and happy PHPing!