Install packaging

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Install packaging

Post by alex.barylski »

I need a library which does not rely on PEAR or similar packaging system.

Basically I want to wrap up all my application files into a single install.php type deal so I can make installation a little less headachy for shared host users, this way my app can set the permissions on files, etc.

Anyone use any common technique for packaging files into a single install.php or similar? Something that would work on all servers, shared, dedicated or not?

I'm thinking just globbing over the file system and recording the contents in a hash array type deal, along with the suggested permissions, group, etc.

I've seen this before (I think it was vTiger) and I thought it was a really good idea...permission errors are probably one of the most frequent issues newbies have with installing a web based software product.

Cheers,
Alex
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Install packaging

Post by Chris Corbyn »

How exactly do you plan on setting permissions etc if the permissions are not already set to allow write access? Catch-22 here.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Install packaging

Post by josh »

untar? ( or tar -xf was it? ) ( to clarify, Shouldn't the archive preserve permissions, which in turn should be preserved by the users FTP client? ). Usually the apache user has sufficient privileges to chmod documents in the document root, if they don't the script should just detect it and ask the user to do it
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Install packaging

Post by alex.barylski »

How exactly do you plan on setting permissions etc if the permissions are not already set to allow write access? Catch-22 here.
From what I understand of the problem...on some shared hosts when a user FTP's files to the server their owner is FTP and not Apache. So when a PHP script attempts to write to an INI file or whatever a 'file permissions' error occurs.

This is typically fixed by chmod'ing the files to 777 -- as Apache is run as user nobody, right?

I don't want users to:

1. Set permissions
2. Set permissions to anything more than 775

So I figure, I will have them upload a self-extracting PHP file, which once uploaded and invoked:

Code: Select all

http://www.domain.com/install/
This would create the files in the required places (along with directories) using PHP and thus the owner of each file is now PHP so each file permission would only need to be 775 at the very most.

I'm not sure how to go about solving these issues. Now I'm thinking just have the installer copy files from the install.php to their appropriate places, set permissions and in a front controller plugin, check whether 'install' directory exists and exit until it's deleted.
untar? ( or tar -xf was it? ) ( to clarify, Shouldn't the archive preserve permissions, which in turn should be preserved by the users FTP client? ).
No tar...this is built to work on Windows machines as well...want everything PHP if possible. No tar libraries, etc. I'm thinking just stash the contents of the file as a hexdump in associative array, like:

Code: Select all

$GLOBALS['/var/some/file/'] = 'Some hexdump or similar';
Usually the apache user has sufficient privileges to chmod documents in the document root, if they don't the script should just detect it and ask the user to do it
I think I address this above?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Install packaging

Post by Chris Corbyn »

What does a hexdump solve that having the real file around to copy() doesn't? It will use a lot of memory if PHP has to store the entire hexdump of your application in memory.

I'm not sure about Apache having write access to the document root on most servers. That conflicts with what PCSpectra is trying to get around (the fact that the FTP user has write access, but Apache doesn't). This would not be true for hosts that are using SuExec to run under the same userid as the FTP user.

You'll (probably) need the user to set write permissions at least once in order to get started applying the remaining permissions automatically.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Install packaging

Post by Benjamin »

alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Install packaging

Post by alex.barylski »

What does a hexdump solve that having the real file around to copy() doesn't?
Just to keep all the files in one place -- a single install.php or similar.

After thinking about it though...I'm willing to bet that would crash on many shared servers so copying the files from one source to another makes the most sense me thinks
Post Reply