A quick look at the upcoming packaging tool in the Windows Azure SDK for PHP

By , June 29, 2011 7:57 am

Note: The Windows Azure SDK for PHP referenced in this post has been released and there is official documentation available at http://azurephp.interoperabilitybridges.com/articles/packaging-applications please be sure to also check there as the content in this post may become outdated.

The current Windows Azure Command-line tools for PHP can be sometimes difficult and frustrating to work with. Luckily the Interoperability team at Microsoft has listened and is working hard to make Windows Azure development for PHP developers easier. The upcoming Windows Azure SDK for PHP begins to consolidate the various PHP toolkits into one package. This package will have a brand new and way easier to use packaging tool!

I am going to provide you with a brief intro to this tool and how to use it. Take note that this code is still in development and should be used with extreme care. There is no guarantee that it will work until the official release of the new Windows Azure SDK for PHP.

Get a copy of the Windows Azure SDK for PHP from Subversion

Since the new SDK has not yet been officially release we will need to get the most up to date copy from the Subversion repository on CodePlex.

Fire up your favorite tool and pull from this URL:
https://PHPAzure.svn.codeplex.com/svn

Find the new Package tool

Open the folder the checkout is in and navigate to the trunk folder. You will notice that there is now a bin folder. Inside that folder you will find several batch scripts. These will comprise the new set of command-line tools. Watch the Azure PHP website for tutorials on using each tool when the new SDK is officially released.

For now all we care about is the Package.bat file.

Setup a project

*Added* You can download the HelloAzure sample project from GitHub at https://github.com/blobaugh/Windows-Azure-Sample-Kit-4-PHP/tree/master

With the old command-line tools it was difficult to control your .csdef and .cscfg files. With the new tools in the SDK it is a breeze. The following is the structure you will need for a project with a single web role named WebRole.

  • ProjectDir
    • WebRole/
    • ServiceDefinition.csdef
    • ServiceConfiguration.cscfg

As a quick demo copy a .csdef and .cscfg from a previous project and inside the WebRole folder create an index.php file containing your favorite version of Hello World.

Build the package

Here is the part that will amaze you with its ease! Open a command prompt and navigate to the bin dir for the Windows Azure SDK for PHP which you checked out from Subversion. In that directory you will run this command (substitute the paths for yours of course)

Package.bat create –in=”Path\to\your\package” –out=”Path\to\output\package\files” –dev:true

  • -in – The path to your project
  • -out – The path to place the output files from the packager. This will be the .cscfg and .cspkg, etc
  • -dev – Run the local development fabric? Values are true or false

If it worked your web browser should have opened to http://localhost:81 and displayed your application. Check the output directory you specified and you will find the files you upload through the Windows Azure Portal to get your application running on Windows Azure.

Wrap up

Keep a close eye on both the Open @ Microsoft blog and the Azure PHP website for an announcement of the new Windows Azure SDK for PHP, along with tutorials on using the new tools.

Leave a Reply

2 Responses to“ A quick look at the upcoming packaging tool in the Windows Azure SDK for PHP”

  1. wp themes says:

    Awesome info and great post

  2. Very helpful blog. Very clear commentary and suggested phrasing are most impressive, as is your generosity in sharing this explanation and example. I would also encourage everyone to bookmark this page to your favourite service to help spread the word. I recommended the next link to learn more! learn php. Thanks

Theme by Blam Designs
Based on Themocracy

Add this ribbon to your WordPress website re-abolish slavery
%d bloggers like this: