簡體   English   中英

如何使(新的)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開頭的行上$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。 我的composer.json文件如下所示:

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

當我運行composer.phar時,得到以下結果:

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.

我看不到我在做什么錯。

通過composer的梨和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": "*"

這些為作曲家提供了更明確的信息,使用這種方法,事情似乎就可以了。

希望能有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM