2

I have a zip file which contains around 1058 tgz files. In PHP, I extract the tgz files from the zip file one by one and process and then decompress the tgz file and process the content. The decompression works fine till 1016th tgz file. From 1017th tgz files I am getting "unable to create temporary file" error.

I am usisng PharData->decompress() method to decompress the tgz file in which line I am getting this error from 1017th file.

I have tried with another zip file which has 1158 files. In this case also, only 1016 files were processed (i.e., decompress and other functionalities worked fine). From 1017th file the decompress method throws the above error.

1 Answers1

0

This is a bug #58169, which is on my list to remediate in the coming months. Based on my initial triage, the problem occurs because of the way the Phar library holds open temporary files during (de)compression. There is no way to get around it in PHP. However, you can mitigate it at the OS level.

The number after which the error occurs varies based on your operating system and the imposed open file limit. Web search for "raise open file limit" and your OS to find specific instructions. On Linux, for example, you might do something like is mentioned in this SO answer:

  • try ulimit -n 2048 and if that fails
  • modify the values in /etc/sysctl.conf.
bishop
  • 37,830
  • 11
  • 104
  • 139