Search code examples
phpazurepearazure-web-rolesazure-blob-storage

Azure Cloud Service PHP Pear Packages


I am following this tutorial http://azure.microsoft.com/en-gb/documentation/articles/storage-php-how-to-use-blobs/ on ussing the Azure PHP SDK to access Azure Storage Blobs.

I need to read and write to these blobs from my live Cloud Service running my PHP App. It says that the SDK is dependent on some PEAR Packages and that they should be installed using the "Pear package Installer"

The PHP Client Libraries for Azure have a dependency on the HTTP_Request2, Mail_mime, and Mail_mimeDecode PEAR packages. The recommended way to resolve these dependencies is to install these packages using the PEAR package manager.

This is all well and good on my DEV server, I simply install PEAR and then install the packages. But obviously once the App is packaged and pushed to my Azure Production Cloud Service, it doesn't contain Pear or any of packages. PHP is installed on the Cloud Service when it is spun up using the ServiceDefinition.csdef Startup Tasks. Every new instance has PHP installed on startup.

So how do I get PEAR and these Packages on my Cloud Instance? I have Googled and cannot find anything that explains using Pear on Cloud Instances, yet all the SDK documentation says it is needed?!?

Am I misunderstanding something?


Solution

  • While the PEAR package manager has been a mainstay in days gone by, I think it's rapidly being replaced by Composer and the like.

    You don't HAVE to install using the PEAR tool, however. All it is is an early package manager. You can download the PEAR libraries individually and place them in a common directory http://pear.php.net/package/PEAR/download

    The caveat here is that this is 100% manual and all on you to update packages but PEAR updates are few and far between. Download each package and then do something to set the base include directory.

    set_include_path('/path/to/pear');