Is there a way to uncompress .Z files using php?
After searching some i've found that .z files are files that were compressed using the compress
program. If your php installation allows shell_exec
and your webserver is running unix/linux you could run the uncompress
program on your server. This is the (untested) idea:
<?php
$file = '/tmp/archive.z';
shell_exec("uncompress $file");
Nowadays uncompress
is just nothing more than a one-liner invoking gzip
with proper options. To use gzip
, you don't have execute shell. You can use Zlib extension instead. I'd try something like:
<?php
$contents = zlib_decode(file_get_contents('/path/file.Z'));