开发者

Alternate to PHP exec() function

Currently I am using开发者_如何学Python:

exec("zcat $filename", $output)

To uncompress a .Z type file but unfortunately my hosting company has now disabled this function.

Is there a workaround?

$pathtofile = "filename.lis.Z";
exec("zcat $pathtofile", $output);


do this

echo ini_get("disable_functions");

to know if you are able to use one of the following:

system(); exec(); passthru(); shell_exec();

but if it's a shared hosting all the above are for sure blocked and you will have to find an alternative


.Z files are LZW compression. If you can't run shell commands on your host, you can use an LZW PHP library. Here are two:

  • web wonders
  • php-lzw


system($shell_command, $response_var);

So in your case:

system("zcat $filename", $output);


In my case, disabled commands are

dl
sh2_exec
diskfreespace
disk_free_space
disk_total_space
escapeshellarg
escapeshellcmd
exec
highlight_file
link
lchgrp
lchown
passthru
pclose
popen
proc_close
proc_get_status
proc_nice
proc_open
proc_terminate
set_time_limit
shell_exec
show_source
symlink
system
mail
sendmail

So if one of those commands not blocked in your side, you may find a way to execute command.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜