Is there a way to unzip .Z files using php?

Is there a way to unzip .Z files using php?

+3
source share
2 answers

Currently, uncompressit is nothing more than a one-line call gzipwith the correct parameters. To use gzip, you do not have a runtime shell. You can use the Zlib extension instead . I would try something like:

<?php
$contents = zlib_decode(file_get_contents('/path/file.Z'));
+1
source

After searching for some, I found that .z files are files compressed with the program compress. If your php installation allows shell_exec, and unix / linux is running on your web server, you can run the program uncompresson your server. This is an (untested) idea:

<?php
$file = '/tmp/archive.z';
shell_exec("uncompress $file");
+1
source

All Articles