I am in need of a way to store a file in memory very briefly in PHP, the file is being built and then sent right off to another web service. I see that as of PHP 5.1 the php://temp
and php://memory
streams are available, but there doesn't seem to be a whole lot of difference between the two: php://temp
supports the stream_select()
function and php://memory
does not. Which one should I be using in this case, or is there a better way to do memory mapped files in PHP?
Straight out of the relevant manual page:
The php://memory wrapper stores the data in the memory. php://temp behaves similarly, but uses a temporary file for storing the data when a certain memory limit is reached (the default is 2 MB).
Source: I went on Google and searched for php temp memory
. This was the first result, with the answer in the extract.
php://temp
sounds appropriate for your use case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With