LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-10-2007, 04:06 PM   #1
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
create self executing zip file in PHP


I have been extending my shopping cart to permit online purchase and download of my (windows only) software package.

Now, there are multiple versions of my software available, all built off the same codebase, but configured using one configuration file.

The installation has hundreds of files, so for configuration management reasons I would prefer to not have an unzipped installation available anyplace on my website. Hence, I want to zip up an installation, make it self-extracting (I do this with winzip on a Windows machine) then upload the package, complete and ready to go EXCEPT for the configuration file.

I then will place one configuration file for each downloadable configuration on the site, and when a purchaser makes a choice and pays, I would like to be able to add that one file to the self-extracting zip on the fly, then download it to the purchaser. THis way, the purchaser clicks on the download, it installs itself, we're done.

The only alternatives I see are to either send the configuration file as a separate download (requiring more work and more smarts on the part of the buyer) or have a complete zip file for each configuration that I support (maintenance nightmare).

Now, googling quickly turned up how to construct a zip file and how to add a file to a zip file using PHP. But I haven't found a way to add a file to a self-extracting zip.

Does anyone know how to do this? I am not wedded to winzip; I use it because it does what I need but I'll use any zipper or format so long as it is compatible with Windows and does what I need via PHP.
 
Old 04-11-2007, 12:20 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

If you have Windows on the server, I think it's fairly easy - just use the exec function or something, to run a command that does the job. I don't know WinZip, I use WinRar instead. It has a lot more options, compresses better, and everything can be done from the command line. The reason I got it was I needed it to store file permissions as well as the files.

Without Windows I think it's harder. Wine should probably work, I don't think a command line can use that many system calls.

Talking of WinRar, I bought it, and I think their system was kind of cool. Instead of the usual serial numbers, they emailed me a .rar file. Installing the evaluation, it registers .rar files as well as a lot of others. When I opened the rar file in the email, I got a dialogue - "Thank you for your support" - that was it.
 
Old 04-11-2007, 12:38 PM   #3
clb
Member
 
Registered: Sep 2004
Location: UK
Distribution: Ubuntu
Posts: 117

Rep: Reputation: 16
Not sure about self extracting, but this site: http://www.phpit.net/article/creatin...namically-php/ has a tutorial on using PHP and PEAR to dynamically create zip files.
 
Old 04-11-2007, 12:44 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,703

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Take a look at this:
http://www.linuxquestions.org/questi...d.php?t=242520

Last edited by michaelk; 04-11-2007 at 12:46 PM.
 
Old 04-11-2007, 04:46 PM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Original Poster
Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by michaelk
Well now.

That looks very promising indeed. The only shortcomings I see are that it only wants to unzip to the current directory and executing a command after unzipping is a compile time option that is normally disabled. But the source is available and I can live with unzipping into the current directory.

Thanks.

BTW...to Guttorm...the server that hosts my website is Linux. I do everything with Linux, except develop that package. The package is windows only because the database that I use is windows only. But they are deploying a new generation product that will be multi-platform and I'll be following with a multi-platform version of my software.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing shell commands through PHP!!! Richtown Linux - Newbie 6 04-12-2006 02:57 PM
PHP not Executing Sometimes Herbalist Programming 3 06-20-2005 07:41 PM
How executing c program with php? payal_shah Programming 6 04-08-2005 10:44 PM
create a self-extracting zip file with zip on solaris? samsolaris Solaris / OpenSolaris 3 10-15-2004 01:50 AM
Executing PHP symbolic link file from site ricocali Linux - General 6 11-22-2002 10:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration