Windows azure Web サイト (php) をセットアップしており、azure ストレージ (blob) 環境に接続したいと考えています。PHP チュートリアルから Blob サービスを使用する方法について説明しましたが、それは Web サイトがローカルに保存されている場合についてのみ言及しています。
いくつかのケースを設定しようとしましたが、常に http 500 エラーが発生します。
<?php
require_once 'WindowsAzure/WindowsAzure.php';
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\ServiceException;
//$connectionString = "\WindowsAzure\Blob\Internal\IBlob";
// Create blob REST proxy.
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString); // the code gets stuck at this line, result is a HTTP 500 error
$content = fopen("C:\Users\Public\Pictures\Sample%20Pictures\Woestijn.jpg", "r");
$blob_name = "newBlob";
try {
//Upload blob
$blobRestProxy->createBlockBlob("default", $blob_name, $content);
}
catch(ServiceException $e){
// Handle exception based on error codes and messages.
// Error codes and messages are here:
// http://msdn.microsoft.com/en-us/library/windowsazure/dd179439.aspx
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code.": ".$error_message."<br />";
}?>
同様の問題を抱えていて、それを理解することができた人はいますか?
編集:
エラー検索で絞り込みました。ServicesBuilder.php ファイルにアクセスし、ページが機能しなくなるまで、1 行ずつコメントアウトしました。以下に示すように、失敗した行は$httpClientです。
public function createBlobService($connectionString)
{
$settings = StorageServiceSettings::createFromConnectionString(
$connectionString
);
$httpClient = $this->httpClient();
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme(
$settings->getBlobEndpointUri()
);