如何获得(新的)Azure PHP SDK的工作


How to get the (new) Azure PHP SDK to work?

我已经在azure网站上使用了旧的PHP azure SDK,但我想迁移到新的。不幸的是,我不能让这个新的工作。

我已经手动安装了SDK,并遵循本页上的"使用"步骤:https://github.com/Azure/azure-sdk-for-php。而不是'使用'我使用'要求',也许这就是它出错的地方,但我不知道如何使用名称空间。

我用来编辑代码的环境是dreamweaver。

以下代码在以$tableRestProxy

开头的行出错
<?php
    require("WindowsAzure/WindowsAzure.php"); 
    require("WindowsAzure/Common/ServicesBuilder.php");
    require("WindowsAzure/Common/ServiceException.php");
    require("WindowsAzure/Table/TableRestProxy.php");       
    $connectionString = 'DefaultEndpointsProtocol=https;AccountName=[AccountName];AccountKey=[AccountKey]';
    // I do know that I have to declare the AccountName and AccountKey here. Left it out for privacy reasons.       
    $tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString);
?>

现在我正在尝试使用Composer来安装SDK。我的作曲家。Json文件看起来像这样:

{
    "require": {
        "microsoft/windowsazure": "*"
    },          
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net"
        }
    ],
    "minimum-stability": "dev"
}

当我运行编写器时。现在我得到以下结果:

Onwijs@JEROENVINK /e/Users/Public/Documents/00_speeltuin_azure/newsdk
$ php composer.phar diagnose
Checking composer.json: OK
Checking platform settings: FAIL
The xdebug extension is loaded, this can slow down Composer a little.
Disabling it when using Composer is recommended, but should not cause issues bey
ond slowness.
Checking git settings: OK
Checking http connectivity: OK
Checking disk free space: OK
Checking composer version: OK
Onwijs@JEROENVINK /e/Users/Public/Documents/00_speeltuin_azure/newsdk
$ php composer.phar install
Loading composer repositories with package information
Initializing PEAR repository http://pear.php.net
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for microsoft/windowsazure 0.4.0 -> satisfiable by mi
crosoft/windowsazure[v0.4.0].
    - microsoft/windowsazure v0.4.0 requires pear-pear/http_request2 * -> no mat
ching package found.
Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your min
imum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> f
or more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common
 problems.

我不知道我做错了什么

似乎pear和Azure SDK通过composer存在问题。

我通过修改我的作曲家找到了一种绕过它的方法。Json文件看起来像这样:

{
    "require": {
        "microsoft/windowsazure": "*",
        "pear-pear.php.net/http_request2": "*",
        "pear-pear.php.net/mail_mime": "*",
        "pear-pear.php.net/mail_mimedecode": "*"
    },          
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net"
        }
    ],
    "minimum-stability": "dev"
}             

注意这三行

"pear-pear.php.net/http_request2": "*",
"pear-pear.php.net/mail_mime": "*",
"pear-pear.php.net/mail_mimedecode": "*"

这些为编曲者提供了更明确的信息,使用这种方法,事情似乎很好。

希望对你有帮助。