Page 1 of 1
Install packaging
Posted: Mon Apr 06, 2009 9:21 pm
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
Re: Install packaging
Posted: Mon Apr 06, 2009 9:25 pm
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.
Re: Install packaging
Posted: Tue Apr 07, 2009 10:09 am
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
Re: Install packaging
Posted: Tue Apr 07, 2009 6:09 pm
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:
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?
Re: Install packaging
Posted: Wed Apr 08, 2009 1:42 am
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.
Re: Install packaging
Posted: Wed Apr 08, 2009 2:24 am
by Benjamin
Re: Install packaging
Posted: Wed Apr 08, 2009 12:06 pm
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