Skip to content

"Out of memory" sending large files #15

Closed
@jack-theripper

Description

@jack-theripper

I'm sending a request method PUT

Fatal error: Out of memory (allocated 801898496) (tried to allocate 800528777 bytes) in php-http\curl-client\src\Client.php on line 183

why CURLOPT_POSTFIELDS ?

sample code

$stream = new Stream($file_path, 'rb');
$request = new Request('http://localhost/test.php', 'PUT', $stream);
$response = $client->sendRequest($request);

Description PSR-7 Streams written

Attempting to represent the body of a message as a string can easily consume more memory than intended because the body must be stored completely in memory. Attempting to store the body of a request or response in memory would preclude the use of that implementation from being able to work with large message bodies.

but Client.php reading full body in variable (in memory).
what to do?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions