CloudObjects - Handling Exception When Objects Server Down? Causes 503 errors on our page


I’ve been noticing errors in our logs and user complaints when they try deleting items on our site. For example, they create an item listing on our site. Then later when they delete the item, our script deletes the item from our database, and then attempts deletes all the images associated with the item. The images are stored in DreamObjects. At random, sometimes it doesn’t connect or the server is down. When the S3 PHP API attempts to connect to DreamObjects, it causes a fatal error and the customer is left with a 503 or 500 type error on their browser.

Here is a quick example of our “delete-item.php” script:

require_once("includes/cdn/index.php"); // DreamObjects config/setup include

///// (php for deleting stuff in our database) /////

$attempts = 0;
do {
  if ($cdn->doesObjectExist("(mybucket)","path")){
    if (cdndelete($cdn,"path")) {
      $imgdeleted = 1;
while ($imgdeleted != 1 && $attempts < 10);

Then here is the “includes/cdn/index.php” file stuff:

define('AWS_KEY', '*************************');
define('AWS_SECRET_KEY', '*******************************');
define('HOST', '');
define('REGION', 'us-west-1');

$cdnbucket = '(my bucket)';

// require the AWS SDK for PHP library

use Aws\S3\S3Client;

// Establish connection with DreamObjects with an S3 client.
$cdn = new Aws\S3\S3Client([
    'version'     => '2006-03-01',
    'region'      => REGION,
    'endpoint'    => HOST,
        'credentials' => [
        'key'      => AWS_KEY,
        'secret'   => AWS_SECRET_KEY,

function cdndelete($cdn,$key) {
    'Bucket' => '(mybucket)',
    'Key'    => $key,
  return true;
 catch (S3Exception $e) {
  return false;	

How should these files be set up so that if the DreamObject server is down when someone is deleting/uploading images, it won’t result in a 500/503 error page for the user (won’t kill the rest of the delete-item.php script)?

Facing this issue go to hope they will slove your issue within 1 days.

download videoder app // notepad ++ // download psiphon pro

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.