• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Upload THEN unzip xenforo folder (installation)

Marc

Well-known member
Thought I would post this up here as it is something that I have not long since started doing. I have seen a fair few people do this (myself included). You unzip the package you download from the customer area, and then upload the files from the upload folder, but it takes ages.

So instead, upload the zip file into the folder you wish to use. Then you need to create a phpfile named unzipxen.php with the following content:

PHP:
<?php

$filename = escapeshellarg (dirname(__FILE__)."/YOUR_ZIP_FILE_NAME_HERE.zip");
$destination_folder = escapeshellarg(dirname(__FILE__));

echo $filename;
echo "<br />";
echo $destination_folder;
echo shell_exec ("unzip -ou $filename -d $destination_folder");

?>

The upload this file to the same folder. Then go to www.yourserver.com/thefolder/unzipxen.php and it will unzip the contents of the zip file for you. All you need to do now is move the stuff out of the upload folder, which you can do on ftp in most ftp clients :)

PLEASE NOTE: will only work if it is not in safe mode. And please ensure you delete this file and the zip when you have unpacked.
 
Interesting...I would have not even thought of this, I really just assumed this would have to be done from CLI. Thanks for sharing
 
It will only work, if you're allowed to run shell_exec

BUT AFAIK most of the hosters don't allow this^^

And if you're doing it from the CLI, then you could create a small shellscript to unzip, create a backup from the old files and owerwrite the old files automatic;)
 
It will only work, if you're allowed to run shell_exec

BUT AFAIK most of the hosters don't allow this^^
As long as you have root access to your machine you can change this ...correct?

And if you're doing it from the CLI, then you could create a small shellscript to unzip, create a backup from the old files and overwrite the old files automatic;)
Do you have this documented?...If not I would love to see a link to a site displaying this or the usage behind it (shellscript to unzip).
 
Would also be intereted in what other methods there are. I have a dedicated box for my server so havent had the problem of not having access to run shell_exec.
 
At some hosts, unless PHP runs under your own user ID (using suEXEC or cgiwrap on our host, as one example, where the php5.cgi can be run under our user ID), it may write the files as user "nobody" which could be problematic. This script would not work as is at the host I use unless I temporarily enabled suEXEC for my entire site or, at least, the XF directory in order to install the files. Fortunately, two lines in htaccess are all I need to activate it.

Command line is still preferred (it's all I use--much faster and safer), but in the right circumstances, this script is a handy tool to have on hand.
 
This would take me longer sadly am sure this would of done great 10 years ago when net speed sucked
 
I upload the zip file to my ftp space and then unzip it through shell via unzip command, or just click extract in the cpanel file manager and extract the zip, overwriting my xenforo folder.

I don't understand why would anyone need this?
 
I don't understand why would anyone need this?

Some hosts don't even have a command line shell. I had one or two hosts for clients I had like that, and they were difficult to work with (the hosting account, not the client). I personally will never use a host that doesn't at the bare minimum offer an SSH command line shell and SFTP. I do so much via command line that I can't imagine trying to work with a server without having that kind of access.
 
Some hosts don't even have a command line shell.

Yes, most shared hosting companies don't allow shell access for security reasons (which I agree) but why would any host disable shell access but enable shell_exec? It is highly unlikely.

As long as you have root access to your machine you can change this ...correct?

If you have root access you already don't need this script. Just use the unzip command.

If you don't have shell access, you probably have a hosting control panel. All control panels I have seen have a file manager feature in which you can extract zip files. Here's an example from cpanel.

Capture.webp
If you don't have shell access, and if you don't have a control panel either, then this script may be useful (if shell_exec is enabled) but I can't imagine a hosting account which doesn't have at least one of them.
 
Not sure how it would be quicker to log into your cpanel, or log into shell than it would be to upload one php file when you are already uploading the zip anyway. Thats the reason I do it to be honest, as its quicker than me messing about logging into shell expecially since logging into shell isn't something I do very often and I always keep this file in the same directory I download the zip to from here.

Dont get me wrong, I know there are plenty of other

This would take me longer sadly am sure this would of done great 10 years ago when net speed sucked

You obviously havent used ADSL in the UK lol
 
Top Bottom