Is everyone here using the S3.php to handle Space actions from PHP code?


Everything is working so far beside the deleteObejct call, When I try to run it with:

Bucket: bucket-name
URI: bucket/profiles/json-file.json

That doesn’t work, they work if it’s the upload call, I’ve also tried removing the bucket name from the URI, that didn’t work either.

I keep getting this error:

PHP Warning:  S3::deleteObject(): [403] Unexpected HTTP status in /var/www/html/cron/classes/S3.php on line 440

Error 403 is access denied, so maybe it’s the URL that is wrong?

I’ve changed all the space settings, so endpoint is:

public static $endpoint = 'ams3.digitaloceanspaces.com';
public function __construct($accessKey = null, $secretKey = null, $useSSL = false, $endpoint = 'ams3.digitaloceanspaces.com', $region = '')

I hope someone can help as I really need the option to delete an object from my code.


  • Just checked the URLs in the code when using putObjectFile and deleteObejct.

    deleteObejct: http://bucket.ams3.digitaloceanspaces.com/profiles/file-name.json
    putObjectFile: http://ams3.digitaloceanspaces.com/bucket/profiles/file-name.json
  • Just gathered some more info about the fail action.

    stdClass Object
        [error] => Array
                [code] => 403
                [message] => Unexpected HTTP status
        [body] => SimpleXMLElement Object
                [Code] => SignatureDoesNotMatch
                [RequestId] => tx000000000000063f73fc-005f145a4-ab90b1-ams3b
                [HostId] => ab90b1-ams3b-ams3-zg02
        [headers] => Array
                [size] => 196
                [type] => application/xml
                [date] => 1598113188
        [code] => 403

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

solved it, no idea what I did, but I changed a lot and now it works.