Remote uploading & Extraction of CMS files

Every now and then, I get requests from friends to upload different CMS of their choice to their server(s). Those who trust me, gives me their password and I do the honour by uploading. Now, there is this problem, popular CMSs , whether it is Joomla or WordPress or phpBB are showing the obesity trend now a days. The packed zip/tar/gz files are getting bigger in size. Meaning, I will have to download the zip and then unzip and upload to the server. Needlessly to say, most of the cheap shared hosts does not come with Shell access. So, I thought of giving a very simple script of much used and familiar commands to remotely download a package to the server and then automatically extract it.It’s not rocket science and it’s nothing new, but for those outthere who are new to the arena, this could be a life saver.

So, how we do it?

Step 1 : Open a text file and write
<?php

  $foo = system('wget
Step 2 : After wget give a space and put your direct download link of the CMS package. In my case, for Joomla 1.6
<?php

  $foo = system('wget http://joomlacode.org/gf/download/frsrelease/13869/60198/Joomla_1.6.0-Stable-Full_Package.zip

Once you done that, close the wget part

<?php

  $foo = system('wget http://joomlacode.org/gf/download/frsrelease/13869/60198/Joomla_1.6.0-Stable-Full_Package.zip ~',$output);

what the above part will do it, download the package from the developer’s server and store it at the same location as this script.

Step 3 : Now that we got the CMS on our server as zipped file, we need to unzip it. So, add the following line
<?php

  $foo = system('wget http://joomlacode.org/gf/download/frsrelease/13869/60198/Joomla_1.6.0-Stable-Full_Package.zip ~',$output);    system('unzip Joomla_1.6.0-Stable-Full_Package.zip');

Please note, after unzip I have used the same zipped file name that we have just downloaded.

So the complete 2 line script is:

<?php

  $foo = system('wget http://joomlacode.org/gf/download/frsrelease/13869/60198/Joomla_1.6.0-Stable-Full_Package.zip ~',$output);
  system('unzip Joomla_1.6.0-Stable-Full_Package.zip');
?>

Instructions to use:

  • Change the source link and zip file name to suit your need.
  • Then put the file on your server root or any designated folder.
  • Change the folder permission to 777 using CHMOD
  • Now, call the file http://your-server.com/file.php

Apart from CMS, this tiny script can be used for server-to-server single file transfer.

[dm]4[/dm]

2 Replies to “Remote uploading & Extraction of CMS files”

    1. Possibly you are right. However, this works on Mediatemple, Siteground, Godaddy. I did not use others in last few years, so cannot gurantee it would work.

Leave a Reply