Extract CAB files with PHP

2019-02-25 19:47发布

问题:

Running PHP on IIS6, how can I open and extract the contents of a CAB-file? Is there any way of doing this witout using exec? I don't have permission to run stuff with exec.

回答1:

Without external tools like cabextract this won't work. PHP has no functions for this.



回答2:

This is unfortunately too long as a comment. I wrote a PHP based cab-archive reader a long time ago. Seeing how there is still interest, I put the sources online with the caveat that the project is not pretty, rather limited (no extraction of compressed/stored files) and was not written by a proficient programmer. It may only serve as a starting point.

  • Github: php-cab-reader


回答3:

I've written a library for extraction of CAB archives: https://github.com/wapmorgan/CabArchive

  • Extraction of uncompressed files is supported on all versions.
  • Extraction of compressed archives with MSZip compression works only on latest PHP versions (7.0.22+, 7.1.8+, 7.2.0).
  • Extraction of compressed archives with LZX compression is not supported.


标签: php cab