0

After building an *.exe we upload that file as base64encoded JSON String to an API Endpoint, which is written in PHP by using the Framework Laravel. The JSON Payload looks like:

payload = {
        'operating_system': 'windows',
        'architecture': 'amd64',
        'min_system_version': '10.0',
        'file': {
            'content': encode_base64_file(file),
            'mime_type': 'application/exe',
            'checksum': {
                'type': 'sha256',
                'sum': sha256_checksum(file)
            }
        }
    }

On submit a file with approximately 280MB everything works like a charm. Since we upload a new version with now 680MB, the server (Plesk Obsidian v 18.0) closes the connection without response.

In use:

  • Apache 2.4

  • no Nginx Proxy

  • PHP 7.3 (Plattform will be updated soon)

  • PHP Settings (temporary for debugging)

  • Memory Limit = 4GB

  • Post Max Size = 4GB

  • Execution Time = 120

Debug output:

> User-Agent: curl/7.79.1
> Accept: */*
> Authorization:Basic XXXXXXXX
> Cookie: XDEBUG_SESSION=start
> Content-Type: application/json
> Content-Length: 646833265
> Expect: 100-continue
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Empty reply from server
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, close notify (256):
curl: (52) Empty reply from server

Last attempt was to just display the POST Request in a single PHP File (Example). Same results

We expected that the file uploaded (via Laravel API) as normal and while debugging, that the Plesk Error Log show's at least an error (which doesn't happen). Laravel doesn't run into a catched error too.

Since we don't have full access to the server itself, we are limited in debugging that issue. Does somebody knows, if there is any possible "size limitation" of a POST request related to such a situation?

  • Since you use file checksum, you could consider sending file by chunks. Do you override these two directives `upload_max_filesize, post_max_size` in php.ini or plesk pannel ? – Lounis Dec 01 '22 at 11:05
  • I override those inside the Plesk Panel, and I with a phpinfo(); check I can confirm, that they are set. Right now I try to understand "why" that's happening, but sending bigger files as chunks could be a possible solution. Maybe I give "Guzzle" a try. – Stefano Rutishauser Dec 01 '22 at 12:31
  • Perhaps it's a server host limitation, did you ask them for information about this problem ? – Lounis Dec 02 '22 at 14:32
  • Jep, I already asked them and they don't know where the issue is coming from. : / – Stefano Rutishauser Dec 03 '22 at 16:05
  • We don't know actually which value / limitation let us run into this issue, but since we switched from "FastCGI" to "PHP-FPM", we are able to upload our files again. – Stefano Rutishauser Dec 07 '22 at 07:17
  • Check the execution time, it could have changed when you migrate to php-fpm. – Lounis Dec 07 '22 at 09:45
  • Thanks, I already did that. Settings are now very high since we have to keep the code running to deploy updates every few days. But I'm doing some research to upload files in a more efficient way. - Execution Time: 120 - Memory Limit: 4096M - Max Post Size: 2048M - Max Uploadsize: 2048M – Stefano Rutishauser Dec 07 '22 at 12:08

0 Answers0