SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Notice: This is a discussion thread for comments about the SitePoint article, Programming Amazon S3, Part I.
    __________

    Do you use AWS for any of your current projects? If so, which services, and how do you use them? Or is it something you're considering doing in the future?

  2. #2
    #titanic {float:none} silver trophy
    molona's Avatar
    Join Date
    Feb 2005
    Location
    from Madrid to Heaven
    Posts
    8,259
    Mentioned
    245 Post(s)
    Tagged
    1 Thread(s)
    I used it a few years back but I stop doing it when I decided that I was going to re-do my personal page... which I never did. But now, reading this article I think that it is time to go there and start using them again

    I assume that I will have to create a new account... It was such a long time ago!

  3. #3
    SitePoint Member
    Join Date
    Apr 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been using AWS for a couple of years for maintaining backups (using a client called JungleDisk). I've been wanting to use AWS for my hosting so the new Sitepoint book was timely. I bought the book since it will save me time and give me a framework for moving forward.

    Moving to the cloud for email (using Google Apps) was one of the best things I've done and I expect AWS will help just as much with hosting.

  4. #4
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, code written on the article is different than what in page 67 of the printed book!
    anyways, code in article won't work either:

    $s3->create_bucket("jeff_barr_bucket");

    will return this error:
    The specified location-constraint is not valid

    you must enter it like:
    $s3->create_bucket("jeff_barr_bucket",S3_LOCATION_US);

    // or S3_LOCATION_EU as I read in cloudfusion docs.


    I'm some how disappointed, I got the book to 'Host "My" web site in the cloud' .. I think creating s3 buckets from API does not serve this purpose, I think it will be better to create the first bucket from AWS admin area as we will not do that a lot .. may be author have another opinion that will appear later .. but at very least he must make sure that code .. specially code appear in first chapters work without errors!

  5. #5
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi 2MHost,

    The version of cloudfusion used in the book (and the article) is 2.5. In cloudfusion 2.5, there's no region parameter to create_bucket, so the code functions as described. In the time since the book went to print, Amazon has hired the main developer of Cloudfusion and released a new version of the library as the PHP SDK for AWS. The most significant change is the addition of region support, as you've noticed. Jeff is currently working on a complete errata page and an updated code archive for the book.

    Creating buckets from within your code can be a common task, depending on the architecture of your application. If you have a look at the thumbnail application later in the chapter, and the "cloudlist" application in chapter 11, you'll see that interacting programmatically with S3 is a very common type of operation in a cloud-based application.

    Hope that answers your questions.

  6. #6
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Nottingham, UK
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was having trouble getting examples 2, 3 and 4 to work so I subsequently created a bucket using the AWS console. I could then get example 4 to work but when running 2 and 3 I still get back 'error creating bucket'. So my setup seems OK because I can get list_buckets.php to work but I'm still unable to create a bucket. I'm trying it on both WIndows (WAMP) and Mac (MAMP). On the Mac I do get back after the 'error creating bucket' a 400 status and a lot of code connected to a ResponseCore object but nothing like this in WIndows - just the error message.
    Does anyone have any ideas why this might not be working?
    A slight aside - I found out that uppercase letters and underscores are not allowed in the Irish region (which I am using) when trying to create a bucket in the AWS console but I think are allowed in the US. I don't think this is mentioned in the book - it would be a nice comment to make in this chapter as all the examples use uppercase letters and underscores.
    Thanks

    ah just read the previous post - re: the regions

  7. #7
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Nottingham, UK
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So it seems to be down to the lack of region in the following line in create_bucket.php

    // Create an S3 bucket
    $res = $s3->create_bucket($bucket, S3_LOCATION_EU);

    When adding my region I could create a bucket.
    I'm slightly confused Louis because you say that the code should work as described but for me it didn't until I added the region.
    I am still using Cloudfusion 2.5 version before it became the AWS SDK.

  8. #8
    SitePoint Enthusiast jnbdz's Avatar
    Join Date
    Apr 2005
    Location
    Montreal
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Same problem here. I had to add the bucket via https://console.aws.amazon.com/s3/home

    But I am able to list it via the terminal but not via list_buckets.html.php

  9. #9
    Team ********* Louis Simoneau's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    228
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That's odd. I'll have a look at this on Monday and try to find out what's going wrong. Thanks for the info.

  10. #10
    SitePoint Enthusiast jnbdz's Avatar
    Join Date
    Apr 2005
    Location
    Montreal
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had no problem uploading an image and listing buckets. So it seems it's just creating buckets that is causing me problems. But maybe it's just me.

    (Salut, Louis Simoneau, je suis aussi de Montréal. Bravo, pour votre livre je trouve qu'il est très bien écrit et claire. Il serais "cool" que vous venniez parler au prochain Confoo à Montréal...)

    @+

  11. #11
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Nottingham, UK
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For information - I am also able to upload images - now I've got to that point.
    Also now realise that BOOK_BUCKET is just a constant so uppercase and underscores don't apply to this. However, I still think it might be useful just making it clear in the book what is and isn't allowed in the different regions as I took it that there were no restrictions - influenced by the use of them in BOOK_BUCKET.
    Very good book though I must add!

  12. #12
    SitePoint Enthusiast jnbdz's Avatar
    Join Date
    Apr 2005
    Location
    Montreal
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have had other problems with the code...

    (page: 126) When I load the page http://IP.../book this is what I get:

    Warning: require_once(tarzan.class.php) [function.require-once]: failed to open stream: No such file or directory in /data/src/book/index.php on line 4

    Fatal error: require_once() [function.require]: Failed opening required 'tarzan.class.php' (include_path='.:/php/includes:/data/src/cloudfusion') in /data/src/book/index.php on line 4

    I install cloudfusion exactly like it is shown in the book but it seems tarzan.class.php is missing from the folder for some reason...

    Also I had problems restarting the "httpd" to apply the changes I did to php.ini I tried different command nothing work but I want online and here is the commands that worked:

    /home/webuser/helloworld/bin/stop_apache

    then:

    /home/webuser/helloworld/bin/run_apache

    So my question is: Do I just copy the code from:

    http://code.google.com/p/tarzan-aws/...rzan.class.php

    and put it on my server? or is there something else?

  13. #13
    SitePoint Enthusiast jnbdz's Avatar
    Join Date
    Apr 2005
    Location
    Montreal
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried creating a new tarzan.class.php file on my server...

    This time I get this error:

    Fatal error: Class 'AmasonS3' not found in /data/src/book/index.php on line 6

    Now I am not sure what's wrong...

  14. #14
    SitePoint Enthusiast jnbdz's Avatar
    Join Date
    Apr 2005
    Location
    Montreal
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I made a mistake when writing Amazon I wrote Amason... But still, the wget http://tarzan-aws.googlecode.com/fil...fusion_2.5.zip

    Does not contain tarzan.class.php

    This is why this time I setup the sdk from amazon: http://aws.amazon.com/sdkforphp/

    Luckily it is very similar to cloudfusion. The only thing I had to change in the code on page 125, is require_once('tarzan.class.php') to require_once('sdk.class.php').

    I did not need to change anything else. Very easy to setup.

    Here for noobs that need more details on what I did:

    1. In "/data/src" I downloaded the SDK. So with "cd" command go to "/data/src".

    2. Get the zip SDK: wget http://pear.amazonwebservices.com/get/sdk-1.0.1.zip

    3. unzip sdk-1.0.1.zip

    4. rm -f sdk-1.0.1.zip

    5. Move the folder of sdk-1.0.1 in sdk-1.0.1 to /data/src. I know it's the same name... It's a overhead... So change it... you can use mv command to do that.

    6. Then go to /etc/php.ini and change the include_path...

    7. In php.ini change "date.timezone" to your time zone... If you don't you will find your self with some problems...

    8. In the sdk-1.0.1 folder change the config-sample.inc.php to config.inc.php and add your keys...

    9. Change the require_once...

    You should be cool with this setup... If you have any problems it might be because there is something missing. To test your setup go to your sdk-1.0.1 folder then go to _compatibility_test folder and then execute with PHP: sdk_compatibility_test_cli.php

    Or you can use "sdk_compatibility_test.php" in the browser... But you will have to move it...

    I will continue... If I find any other problems and solution I will post them here...

    Also for the past problems try setting-up the SDK it my be the solution... I haven't test it yet but it would not hurt to try...

    Peace!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •