PHP SDK stopped working

0

Hello, I have started facing problem in SDK on 15th April 2024 14:00 IST. Process keep loading on:

try {
       $result = $s3client->putObject([
           'Bucket' => $bucket_name,
           'Key' => $file_name_audio,
           'SourceFile' => "uploads/".$file_name_audio
       ]);
      

   } catch (Exception $exception) {
       echo "Failed to upload with error: " . $exception->getMessage();
   }

& after time out 504 error I am facing.

gefragt vor einem Monat141 Aufrufe
1 Antwort
2
Akzeptierte Antwort

Error 504 usually indicates that the server did not receive a timely response from another server accessed while attempting to load the web page or fulfill another request.

  1. Check Network Issues: Verify that your server has a stable and fast internet connection. Network issues can sometimes cause timeouts, especially when uploading large files.

  2. File Size and Timeout Settings: Consider your upload file size. If the file is large, the upload might take longer than the server's timeout setting. If available, you can try increasing the timeout setting in your PHP configuration (max_execution_time in php.ini) and the client-specific timeout in the SDK.

  3. AWS S3 Bucket Permissions and AWS Region - I assume it was not changed

  4. Error Handling: Update your error handling to log more details. You can extend the catch block to get more insight into the problem. Here's an example of how you might expand your error logging:

} catch (Aws\S3\Exception\S3Exception $e) {
    // Catch an S3 specific exception.
    echo "AWS S3 Error: " . $e->getMessage();
} catch (Exception $exception) {
    echo "General Error: " . $exception->getMessage();
}
  1. SDK Version: Make sure you use an up-to-date version of the AWS SDK for PHP. Sometimes, bugs or issues are resolved in newer versions of the SDK.

  2. Test with a Smaller File: Try uploading a smaller file to see if the issue is related to the file size or the upload process.

profile picture
EXPERTE
beantwortet vor einem Monat
profile picture
EXPERTE
Artem
überprüft vor 25 Tagen
  • Hey Oleksil. Thank you for replying. But it gets started without making any changes. So it seems something wrong for temporary. My server has no change, even Aws as well, file is always smaller.

    But that day it was not working and today when I went to code to put your catch of AWS S3, it got started uploading.

    Thank you for give me example of expand the error. It is a knowledge gainer.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen