Reputation: 65
I have such a connection statement to connect the blob storage I've created in windows azure.
$connectionString = 'DefaultEndpointsProtocol=http;AccountName=<accountname>;AccountKey=<secret key>';
$echo "1";
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
$echo "2";
When I put this, "1" is written, but "2" isn't.
Does it mean, $blobRestProxy isn't working?
I try to create a container in my blob storage, but it fails.
How can I fix the problem?
Thanks.
UPDATES:
This is the link the picture which shows the inside of public_html
http://picpaste.com/2-FjXF4Kpo.jpg
These are the links of the picture which shows the inside of website folder
http://picpaste.com/3-CReA0E72.jpg
http://picpaste.com/4-Tjvv3Br7.jpg
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>more</title>
<meta charset="utf-8">
<meta name="description" content="Description goes here">
<meta name="keywords" content="Keywords goes here">
<!--<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/preview.css" type="text/css">
<script type="text/javascript" src="js/main.js"></script>-->
<!--[if lt IE 8]>
<div style=' clear: both; text-align:center; position: relative;z-index:100;'>
<a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a>
</div>
<![endif]-->
</head>
<body>
<div id="wrapper">
<section>
<div class="dynamicContent">
<!--content -->
<?php
$server = "tcp:t656iqht6v.database.windows.net,1433";
$user = "saitarslanboun@t656iqht6v";
$pwd = "Uj8PfOf4";
$db = "misbounstashnew_db";
$conn = sqlsrv_connect($server, array("UID"=>$user, "PWD"=>$pwd, "Database"=>$db));
if($conn === false){
die(print_r(sqlsrv_errors()));
}
?>
<?php
echo '<h3>'.$_GET['course'].'</h3>';
?>
<?php
echo "1";
require_once 'WindowsAzure.php';
echo "2";
use WindowsAzure\Common\ServicesBuilder;
echo "3";
use WindowsAzure\Blob\Models\CreateContainerOptions;
echo "4";
use WindowsAzure\Blob\Models\PublicAccessType;
echo "5";
use WindowsAzure\Common\ServiceException;
echo "6";
$connectionString = 'DefaultEndpointsProtocol=http;AccountName=misbounstashnew;AccountKey=o5uC6pxyUuLTbg4MOTunrzvqw0YzzcP90yyJuNjoue8PT2Rx8eIEZ/ZE1dnqMdsv1Ouvp35Qph5TjmCNiBya3A==';
echo "7";
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
echo "8";
if ($blobRestProxy) {echo "success_blobRestProxy";}
if (!$blobRestProxy) {echo "fail_blobRestProxy";}
$createContainerOptions = new CreateContainerOptions();
try
{
// Create container.
$blobRestProxy->createContainer("mycontainer", $createContainerOptions);
}
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 />";
}
?>
<!--content end -->
</div>
</section>
</div>
<script>
$("a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'dark',social_tools:false,allow_resize: true,default_width: 500,default_height: 344});
</script>
</body>
</html>
Upvotes: 1
Views: 2003
Reputation: 136366
From your code it is not clear if you have imported appropriate Azure libraries (not sure if this is the right terminology). I tried something like the following and it worked for me:
<?php
require_once 'WindowsAzure.php';
use WindowsAzure\Common\ServicesBuilder;
try {
$connectionString = 'DefaultEndpointsProtocol=https;AccountName=account name;AccountKey=account key';
echo "1";
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
echo "2";
} 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/dd179446.aspx
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code.": ".$error_message."<br />";
}
?>
Screenshot of how things look on my computer:
Upvotes: 4