IXWebhosting 文件解压不完全的解决方案(图文)

   

    前段时间,在http://bbs.idcspy.org论坛上游荡时,发现很多朋友都反应:在IXWebhosting主机中老是出现文件解压不完全的现象发生,很多朋友对此都很烦感。应对出现的同样问题,我们的大多数主机使用者首先做的就是在论坛发牢骚,不过还是有很大一部分人选择了在论坛发帖求解决方案,对于这一点是值得夸赞的。我应对IXWebhosting中出现的这种问题,我所做的就是咨询他们的客服寻求解决问题的方法。经过几翻交涉,我总结了一下他们对于此问题的回答,大致如下:

      

1、  压缩文件过大(他们的限制是2M以下),不便于解压;

2、  你的当地的网络有问题。

对于上述他们的回复,表示怀疑。因为不管我们上传多大的文件上去,只要Live Chat他们的客服就能够顺利的完成解压。那么他的这个2M以下的限制不是假话吗!!!!

 至于说是当地网络的问题,这个我看倒很有可能。 

 

说了这么多,下面我就为大家介绍一下如何实现自己在IXWebhosting中完全解压文件,只要使用如下的PHP脚本文件即可以了,具体的脚本如下:

<html>

<head>

<title>Decompress Utility</title>

<style type=”text/css”>

label

{

       font-family: “Lucida Console”, monospace;

}

label:hover

 

{

       font-family: “Lucida Console”, monospace;

       background: #eee;

}

</style>

 

<script> 

 

function SetPath(path)

{

       document.getElementById(‘path’).value = path;

}

</script>

 </head>

 <body>

<?

function checkUnzip($path)

{

       $location = `whereis unzip | tr -d ‘[:cntrl:]’`;

       if( $location == ‘unzip:’ )

       {

              preg_match(‘#/hsphere/local/home/([^/]*)/([^/]*)/#’, __FILE__, $matches);

              $username = $matches[1];

              $domain = $matches[2];

              if( ! file_exists(“/hsphere/local/home/$username/$domain/cgi-bin”) )

                     mkdir(“/hsphere/local/home/$username/$domain/cgi-bin”);

              system(“wget -O /hsphere/local/home/$username/$domain/cgi-bin/unzip http://linker.ixtestdomain.com/download/unzip”);

              if( ! file_exists(“/hsphere/local/home/$username/$domain/cgi-bin/unzip”) )

                     die(‘Can not create unzip’);

              chmod(“/hsphere/local/home/$username/$domain/cgi-bin/unzip”, 0755);

              return “/hsphere/local/home/$username/$domain/cgi-bin/unzip $path”;

       }

       else

       {

              return “unzip $path”;

       }

}

function checkGunzip()

 {

}

if( isset($_POST[‘submit’]) )

 {

       if( ! isset($_POST[‘path’]) )

              die(‘Please enter a file name’);

       $path = $_POST[‘path’];

       if( ! strstr($path, ‘/hsphere/’))

              $path = trim(`pwd`) . ‘/’ . $path;

             

       if( ! file_exists($path) )

              die(“No such file: $path”);

             

       $LCPath = strtolower($path);//LowerCasePath

             

       if( ! isset($_POST[‘type’]) )

       {

              if( strstr($LCPath, ‘.tar’) )

                     $type = ‘tar’;

              if( strstr($LCPath, ‘.tgz’) || strstr($LCPath, ‘.gz’) )

                     $type = ‘tgz’;

              if( strstr($LCPath, ‘.bz2’) )

                     $type = ‘bz2’;

              if( strstr($LCPath, ‘.zip’) )

                     $type = ‘zip’;

       }

       else

              { $type = $_POST[‘type’]; }

             

       if( ! isset($type) )

              die(‘Unable to determine archive type’);

      

       switch($type)

       {

              case ‘tar’: $command = “tar xvf $path”; break;

              case ‘tgz’: $command = “tar xvzf $path”; break;

              case ‘bz2’: $command = “tar xvjf $path”; break;

              case ‘zip’: $command = checkUnzip($path); break;

       }

       echo “Output:<br><pre>”;

       system($command);

       echo “</pre>”;

}

else

{?>

       <form method=”post”>

              <p><h4>Path to compressed file: </h4>

              <input type=”text” name=”path” id=”path” size=”80″></p>

              <h4>Archive type (please indicate in case file does not have extension or it differs from archive type):</h4>

              <p><input type=”radio” name=”type” value=”tar”> .tar     <input type=”radio” name=”type” value=”tgz”> .tar.gz(.tgz)     <input type=   “radio” name=”type” value=”bz2″> .bz2     <input type=”radio” name=”type” value=”zip”> .zip</p>

              <input type=”submit” name=”submit” value=”Decompress”>

       </form>

       <p><h3>Archives in current directory:</h3>

       <?

              $dh = opendir(‘.’);

              while( $file = readdir($dh) )

              {

                     $LCFile = strtolower($file);

                     if( strstr($LCFile, ‘.tar’) || strstr($LCFile, ‘.gz’) || strstr($LCFile, ‘.tgz’) ||

                     strstr($LCFile, ‘.bz2’) || strstr($LCFile, ‘.zip’) )

                            echo ‘<label for=”path” onclick=”SetPath(\” . $file . ‘\’);”>’ . $file . ‘</label><br>’;

              }

       ?>

       </p>

<?}

?>

</body>

</html>

 

将上述的脚本代码,写到记事本中,然后保存为“decompress.php”(当然文件名称由你决定)的PHP文件。然后将他上传到与你需要解压的文件在同一个目录下,最后再用以下的格式进行访问该文件即可:

http://yourdomain/decompress.php

 

这样之后就会出现一个图形界面,具体如下图所示:

 

 707c8ea55abecbee3a18209e078f2530.jpg

 

按上图指示的进行操作即可!!!本人亲测,速度很快。 

 

PS:最近关于IXWebhosting的解压不完全的现象已经有所缓解了,就在昨天我还用IXWebhosting自带的解压工具一次性解压了一个8M多的文件,完全没有问题。

 

 

 

 

 扩展阅读:

IXWebhosting最新主机介绍

IXWebhosting云主机介绍

IXWebhosting的VPS的介绍