title: PHP script to extract zip on whm server
body: <p>I am creating a script that creates a subdomain on a whm server and then uploads a zip through ftp to it. That part is working fine and my newly created subdomain functions properly and the file I want gets transfered to it. </p>
  
  <p><strong>All I need is to unzip this file.</strong> One can easily do it using cpanel's built in file manager but I need this done in my own script. Is there some way to <strong>invoke</strong> cpanel's zip <strong>extraction</strong> functionality <strong>from my script</strong>?</p>
  
  <p>Using PHP's ZipArchive is a problem because it's open() and extractTo() functions <strong>cannot take url</strong> as argument and the zip file I am talking about is not located in a place that I can access without a url. Here's why:</p>
  
  <p>While I am logged in with cpanel_user_1 I created a subdomain that belongs to it's newly created user (let's say cpanel_user_2). I cannot just open the files in cpanel_user_2's public_html folder because that's the way cpanel works - I don't have access to another cpanel user's files. If ZipArhive could work with url I would just do:</p>
  
  <pre><code>        $zip = new ZipArchive;
          $zip-&gt;open('http://subdomain.domain.com/some_zip.zip')
          $zip-&gt;extractTo('http://subdomain.domain.com/folder/some_zip.zip');
          $zip-&gt;close();
  </code></pre>
  
  <p>But it doesn't... and I don't have access to the actual file path of the file.</p>