Mac OS X has made an art of the process of installing an application on the desktop. For a properly packaged application, the process is:
- Locate the application icon in your download directory and optionally move it to another location.
- Double click on the application icon to run.
This is the essence of what apple calls Drag and Drop installation.
Unfortunately, installing web applications has not reached this level of ease of use refinement. An end user oriented web application might require that you:
- Download to your local machine (Using browser)
- Unpack (using 3rd party archive tool)
- Locate and edit configuration files, potentially requiring a knowledge of file system paths on the server, database names, etc.
- Upload (Using yet another tool, such as ftp)
- Change file permissions to allow files to be written to some directories on the server
- Install external components, such as pear modules
- Compile PHP to include required modules
- Edit .htaccess to setup include_path’s and mod_rewrite
Hardly “Drag and Drop.” It would be nice to have something like a drag and drop capability for end users. In this case, the applications could just be moved to the desired location in DOCUMENT_ROOT and run by pointing the browser to it.
Apple has several supporting technologies that facilitate drag and drop install:
“Bundles provide an elegant solution to the problem of grouping related code and resources together.” PHP has the tarball or the zip file, but this requires an unpacking stage. If the user lacks shell access, then the unpacking stage must occur offline. Where is the PHP equivelent of the .JAR or the .WAR? How can the unpack stage be eliminated?
One of the advantages of the bundle is the ability to hide internal resources from the end user. Web applications have the need to hide internal resources. Typically, this can be done with PHP by moving files outside of your DOCUMENT_ROOT (adding another installation stage), hiding resources with .htaccess, or giving them .php extensions when possible (typically for config files). Hardly end user friendly techniques.
Frameworks are a special type of bundle designed for distributing shared code and resources.
Frameworks have a version capability that helps manage DLL Hell situations, where installing or upgrading one application breaks another via shared dependencies. A Framework bundle may contain multiple versions of the same code, and the OS will link to the correct one. Additionally, framework bundles can be embedded into Application Bundles, so that application will always have a usable version available. Embedding helps facilitate drag and drop install because an additional step is not needed to install shared resources.
I think embedding shared resources (libraries like adodb and wact) is the best way to go for application deployment.
Unfortunately, I think PEAR takes a shared commons attitude and resists embedding because of its desire to be in the include_path.
User configuration in OS X is stored in preference files, which are independent files named by application. Well behaved OS X application operate even with their preferences files missing. deleting an applications preference file causes the application to recreate it with the default preferences. (Try deleting an application’s registry keys under windows and see how things go.)
Drag and Drop Web Applications
I think a drag and drop PHP web application should meet the following criteria:
- Make no requirements for PHP_INI_SYSTEM or PHP_INI_PERDIR configuration.
- Make no requirements for .htaccess configuration
- Work with default application level configuration
- Not require writable filesystem permissions
- Not require installing external software
- Not require unarchiving (a wish, i know)
- Not require obscure PHP modules
A wish list, i am sure.
What are best practices for deploying PHP web applications? What applications do this well?