Is there a way to uncompress .Z files using php?
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:
uncompress
gzip