Extract on Server without shell access - Howto?

krwester

Joined: 2004-07-25
Posts: 12
Posted: Thu, 2005-03-10 14:26

I know I saw a post on how to do this, but I have searched and searched and can't find it.

I only have ftp access to my server. Is there any way to extract .tgz source file on the server (instead of extracting it locally and then uploading).

Thanks.

Login or register to post comments
valiant

Joined: 2003-01-04
Posts: 31959
Posted: Thu, 2005-03-10 15:08

propbably your webhost has installed a conntrol / admin panel, where you can configure subdomains, database, emails etc.
most of these control panels have a file browser.
some of these file browsers have a built-in extract archive function. that means, you can upload gallery2.tar.gz or gallery2.zip and then extract this archive with this file browser.

if you don't have such a file browser, you can try to do it with php.
1. check if (g)unzip or (g)tar exists on your webhost.
test.php

<?php
foreach ( array('tar','gtar','unzip','gunzip') as $bin) {
    exec("whereis $bin", $ret);
    print join(', ', $ret).'<br>';
}
?>

upload test.php to your webhost and browse to the file with the webbrowser. now you know if (g)tar or (g)unzip is available on your webhost.
if (g)tar is available, download gallery2.tar.gz from galleryupdates.jpmullan.com and upload it to your server. for (g)unzip, download and upload gallery2.zip.

2. extracting the archive with php on the server
create a file unarchive.php
for (g)tar: (for gtar write gtar -xzf instead of tar -xzf)

<?php
exec('tar -xzf gallery2.tar.gz',$ret);
?>

for (g)unzip: (for gunzip write gunzip instead of unzip)

<?php
exec('unzip gallery2.zip',$ret);
?>

upload the file to the webserver into the same directory where you uploaded the gallery2.tar.gz/.zip archive.
browse with the webbrowser to the unarchive.php script, wait, voila.
-> the script unarchived G2 in a subfolder gallery2 of the same folder where the archive and the unarchive.php script are located.

attention:
it may not work for several reasons.
the gallery2 subfolder and all files/directories under it were created by the webserver user. if you are not in a php CGI + suPHP/suExec setup, you will not be the owner of these files and hence, you cannot move it, delete it or create files in it with your ftp client.
but you can possibly do everything with the file browser in the control panel of your domain.

don't forget to delete the archive and the two scripts test.php and unarchive.php when you're finished.

Login or register to post comments
doktor_G

Joined: 2007-03-01
Posts: 2
Posted: Thu, 2007-03-01 20:08

I am having the same problem, no ssh, no cPanel, moreover I cannot exec anything (php safe mode !?!) ... Is there anything left?

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 10113
Posted: Thu, 2007-03-01 20:13

FAQ: Does G2 work with Safe Mode PHP?
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
peter_web

Joined: 2007-03-02
Posts: 1
Posted: Fri, 2007-03-02 10:11

Hi, I am hosted by Yahoo and I have to unzip remote using ZipDeploy. I don't know how it works but I remember it did also on a free hosting account I had before with php safe mode. HEre's the link : http://ftp-unzip.com/ZipDepoy/

Login or register to post comments