Skip to content

Devbox installation guide

gcheng edited this page May 3, 2012 · 34 revisions

[andrerod: we should split this into Windows and Linux tracks...]

Accessing PHP SDK source code from GitHub

Before you start

  1. Install git client from here.
  2. Obtain pull/push permissions to azure-sdk-for-php.

Download PHP SDK source code from dev branch with your GitHub user

You can perform this task either from GIT Bash or from GIT GUI.

From Git Gui, use the following URL

https://YourGitHubLogin@github.com/WindowsAzure/azure-sdk-for-php.git

From Git Bash, type the following command

git clone -b dev  https://YourGitHubLogin@github.com/WindowsAzure/azure-sdk-for-php.git

Install PHP and libraries

Install PHP binary

[deepakv: there would be users who already have php installed like by using webpi which install non thread safe version of php, so this section could be skipped by those users. It could also be that this section might confuse the user that this sdk would only work with thread safe version??] Download the version 5.3 thread safe version PHP you can use either:

  • MSI: in this case make sure to include the php_info and php_xls as they are not included by default.

  • .zip: you should get copy from go-pear because sometimes it's not included with the download.

During installation, please choose a target path that doesn't contain spaces, which prohibit some scripts to run correctly on Windows. After completing the PHP installation, the PHP SDK code should be workable on the machine.

This document assumes that PHP is installed in C:\PHP

Configure the PHP

The complete instruction on configuring PHP on your machine is available here at this link.

In practice, PHP configuration comprises the following steps:

  • set cgi.force_redirect =0; search cgi.force_redirect in php.ini, uncomment cgi.force_redirect by removing ; at the begging of the line, and set the value to 0.
  • set cgi.fix_pathinfo, search cgi.fix_pathinfo in php.ini, uncomment cgi.fix_pathinfo by removing ; at the beginning of the line.
  • set fastcgi.impersonate = 0, search fastcgi.impersonate in php.ini, uncomment fastcgi.impersonate by removing ; at the beginning of the line, and set the value to 0.
  • disabling fastcgi.logging, search fastcgi.logging in php.ini, uncomment fastcgi.logging by removing ; at the beginning of the line, set the value to 0.
  • set date.timezone = "America/Los_Angeles"
  • enable extension=php_mbstring.dll

Install, upgrade and configure PEAR

From PHP source directory, type [deepakv: I didn;t have go-pear may be a clue on where to get it would help?]

  • go-pear.bat
  • select system for the system|local
  • type enter for all the questions.
  • when go-pear.bat is completed, a new file C:\PHP\PEAR_ENV.reg will be created. Double click this file to register it.
  • upgrade PEAR to the latest version by executing this command: pear upgrade PEAR

Install required libraries:

Note: if you faced any problem first thing to do is to execute these commands:

pear clear-cache
pear config-set preferred_state beta

If that didn't work then you should tackle your mind and figure out the reason!

Requires libraries are:

Run the build (and Unit Test)

Azure SDK PHP build include PHP documentation, unit testing and more. It is driven by ANT build system.

PHP unit test suite depends on properly installed xDebug, the correct configuration of TMG client and the right Azure account credential. For xDebug installation, please refer to xDebug installation page

Install Ant

The full installation manual for ant is available at Ant installation page

The ant can be download from a mirror on this page

Installation bottom line:

  • Extract the Ant to a place on your disk, e.g. C:\ant
  • Add the bin directory to your path. (add C:\ant\bin to your PATH)
  • Set the ANT_HOME environment variable to the directory where you installed Ant. On some operating systems, Ant's startup scripts can guess ANT_HOME (Unix dialects and Windows NT/2000), but it is better to not rely on this behavior.

Install QA tools

PHP QA tools include the unit test, checkstyle, code analysis and many other tools that is useful to ensure high quality PHP coding standard.

pear config-set auto_discover 1
pear install pear.phpqatools.org/phpqatools pear.netpirates.net/phpDox

Install Autoload

The source code of Autoload is available at the this website, however, the installation can be completed in PEAR alone. The following three command will help you install Autoload.

pear channel-discover pear.netpirates.net
pear channel-discover components.ez.no
pear install theseer/Autoload

Ensure that the following bat files reference the correct path to php.exe within them:

  • pdependent.bat
  • phpab.bat
  • phpcb.bat
  • phpcpd.bat
  • phpdox.bat
  • phploc.bat
  • phpmd.bat
  • phpunit.bat

Install vfsStream (Virtual File Stream)

pear channel-discover pear.php-tools.net
pear install pat/vfsStream-alpha

Install xDebug

The binary of xDebug can be found here, please find one according to your machine's configuration.

Install TMG client

[andrerod: this section should also not be on the public wiki...] Please go to this website and pick the right version of the client according to your machine's OS type and install it following the instructions.

Configure Windows Azure Credentials

The unit test requires access of Windows Azure so we need to add some environment variables to get that done.

For storage services add:

AZURE_STORAGE_ACCOUNT: name of the storage account used.

AZURE_STORAGE_KEY: name of the storage account used.

For Service Management add:

SERVICE_MANAGEMENT_SUBSCRIPTION_ID: the subscription id.

SERVICE_MANAGEMENT_CERTIFICATE_PATH: path to an already added certificate to SERVICE_MANAGEMENT_SUBSCRIPTION_ID. The \ sign in the path need to be escaped. For example c:\certificate\testCert.pem should be c:/certificate/testCert.pem .

To to have these credentials you just need Windows Azure subscription Id which will let you:

  • Create storage service (AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_KEY)
  • Add management certificate to this subscription then use it is *.pem path. (SERVICE_MANAGEMENT_CERTIFICATE_PATH)

To add a management certificate read more about Managing Certificates in Windows Azure

If you do not know what is your team Sandbox subscription Id , contact Amit Sharma Sharma.Amit@microsoft.com

Run the build (including unit test)

using cmd.exe, navigate to the PHP SDK project directory, type ant

Install IDE

Install Java Runtime

Download Java Runtime from here and install. For 32 bit operating system, install jdk-7u3-windows-i586.exe, for 64 bit operating system, install jdk-7u3-windows-x64.exe.

Install Netbeans

Netbeans is our perferred php editor you can pick up anything that you like. Download NetBeans full version from here and install following the instruction. This version of Netbeans has dependency of Java Runtime, as a result, please make sure JDK with version number > 1.6 installed properly.

FAQ

[deepakv: I feel this should go to the 'Install Autoload' section, while I am installing autoload if an error occurs I might not scroll down to see the FAQ , instead I would immediately start binging for the error]

  1. What if I see the following error message during the installation of Autoload?

    theseer/DirectoryScanner requires PHP extension "fileinfo" theseer/Autoload requires package "theseer/DirectoryScanner" (version >= 1.1.0) No valid packages found

This is because fileinfo module hasn't been enabled. Make sure that php_fileinfo.dll reside in ext directory. If php_fileinfo.dll doesn't exist in ext directory, please download the zip file, and manually copy php_fileinfo.dll to the ext directory.

  1. When I type ant the build fail in phpunit task without specifying any errors :(
  • Make sure that you've installed all required libraries and PHP extensions.
  • Make sure that you've added the environment variables and they are reflected in the cmd or NetBeans.
Clone this wiki locally