Professional PHP

PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.
« pear config-set preferred_state beta
The value of MVC »

Installing Web Applications

November 24th, 2004

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:

  1. Download.
  2. Locate the application icon in your download directory and optionally move it to another location.
  3. 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:

  1. Download to your local machine (Using browser)
  2. Unpack (using 3rd party archive tool)
  3. Locate and edit configuration files, potentially requiring a knowledge of file system paths on the server, database names, etc.
  4. Upload (Using yet another tool, such as ftp)
  5. Change file permissions to allow files to be written to some directories on the server
  6. Install external components, such as pear modules
  7. Compile PHP to include required modules
  8. 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:

Grouping

“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?

Hiding

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.

Sharing

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.

Preferences

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?

Filed Under

  • Mac, PHP, Usability

Related Posts

  • Installing PEAR Based Applications
  • PEAR Channels
  • Improving Web Application Installation as a Security Imperative
  • Zend PHP Framework
  • A Glimpse into the Future: PHP 6
You can leave a response, or trackback from your own site.

45 Responses to “Installing Web Applications”

  1. DarkWulf says:
    11/24/2004 at 7:56 pm

    To a certain extent there are various PHP Jar implentations, such as PHAR (http://pixelated-dreams.com/blog/archive/000058.html), though they fail in allowing easy one-click configuration.

    One thing that is difficult though is data storage. You are generally going to need either a database or flat files. With a database, you need a configuration (to connect and for table names and so on), while flat files gets you back into filesystem permission problems… so there really isn’t an easy way to get things working.

  2. Helgi says:
    11/24/2004 at 8:27 pm

    I’d say PEAR takes a fairly good approach, because in most cases it’s installed in a global place, which isn’t the same between distros, which of course is a down side, but hey what can we do :)

    Think include path is a good way for the users to being able to move things around between servers, but another alternative comes to mind that is doable, introduce the PEAR_PATH (or whatever) constant that has the global dir path of PEAR, but that would require all PEAR packages and end user when including PEAR stuff to use PEAR_PATH infront in all include/requires, in the same way as WACT does it with WACT_ROOT and similar, a constant that can be overwritten at run time, that way frameworks like WACT could more easily use PEAR I guess, or what ?

  3. Davey says:
    11/24/2004 at 9:31 pm

    Whilst PHAR is far from finished (it was working just FINE till I tried to implement gzip’ing of data, BAH!), when I am done with the package, it will be possible to add/remove/update files in the archive – from files in the archive itself, thus allowing you to do the following:

    1) Set the init script to be a web configurator
    2) take the data input and write a configuration file to the archive
    3) remove the original init script
    4) write a new init script with the standard frontend (i.e. your forum home page)

    Hope that makes sense in my sleep deprived state!

    - Davey

  4. Lukas says:
    11/25/2004 at 6:14 am

    You can have multiple PEAR installations. Also you can dynamically set the include_path. So if you route all your requests through a common file then its fairly simple to use whatever libs that have been bundled with the app (including PEAR packages).

    Automatically installing application data is kinda tricky indeed. Flatfile/SQLite makes things a bit simpler, especially on simple OS’s like windows. But upgrading is still tricky then. Unfortunately the MDB xml schema doesnt seem to have taken off in terms of use, but it can help a ton there since it can automatically alter a database (SQLite 2.x doesnt support alter table though). However I think its ok to go through a web installer in order to type in some needed conf options. Then again I dont believe that drag&drop installation is really the way to go, especially for stuff that I download off the net and that expose themselves (and what data they can access) to the net.

  5. Harry Fuecks says:
    11/26/2004 at 1:28 am

    Think the basic conclusion then some kind of installer program is needed. The problem there though can be installing the installer.

    Think PEAR proves this. Of the top of my head, required knowhow to setup the PEAR installer;

    - Understanding of operating system environment variables (possibly including .profile or registry modification)

    - Understanding of the the PATH environment variable works and how an OS searches it

    - Understanding how PHP’s include path works

    Have a read of some of the comments here – possession of such knowledge cannot be assumed. And if you can’t install the installer, you’re shut out. The result is I think the PEAR installer will only ever be a tool for the experienced.

    Given also that PHP installations vary and that differences between SAPIs can be significant (e.g CGI vs. Apache vs. CLI) for critical functions like getcwd(), in addition to any security restrictions imposed by run scripts under the web server, I don’t believe that PHP is the right tool for a generic PHP installer.

    Installers designed for a single application (eZ publish is an excellent example) can work well but you still need to unpack an archive somewhere.

    What’s proved successful as a model for an installer is one that doesn’t need installing itself. Windows setup.exe programs for example (of which there are a few Open Source options such as Nullsoft Installer and Windows Installer XML. There are a some problems here though

    - there isn’t a generic, cross platform solution (that I’m aware of)

    - on *Nix systems, things like RPMs typically require priveliged access (and assume you can access the shell in the first place, which is not the case on all shared hosts). Also “stand alone” installers (an installer that doesn’t itself need installing) are not common for *Nix applications – Firefox for Linux is a very rare exception, as far as I’m aware. The notion of “package management” is more common in *Nix operating systems.

    - they are, typically, geared for local installation. Meanwhile the typical installation procedure for someone installing a PHP app, I assume, is;

    1. download from website
    2. modify any config files locally
    3. trasfer (FTP, SCP, whatever) to shared host

    More to this rant coming; posting this first

  6. Harry Fuecks says:
    11/26/2004 at 2:44 am

    Rant continued;

    From where I stand think PHP is the wrong tool to write an installer for PHP applications – although it’s become less true with time, PHP is not a general purpose programming language and, in general, PHP is not used standalone – usually runs under a web server.

    As I see it some better alternatives include;

    - Python.

    Is well supported on *Nix, Mac and Windows and Python comes within distribution tools built-in (see here). These can be used to install other things, apart from Python scripts (see here). That means, for someone with Python installed, they just need to type;


    $ python setup.py

    And it’s done.

    But if they don’t have Python installed, further options exist (at least for Windows and Mac) which allow you to distribute a ready-to-execute program (see py2exe [Windows] and py2app (Mac)), bundling the Python dlls. It may be possible to use this to create a self installing PHP application.

    Further ease of use could be provided with wxPython to make a GUI-based interactive installer that will run on *Nix, Mac and Windows. That’s alot more work but would be interesting to explore as an avenue for allowing installation directly to a remote web server (Python has excellent networking tools as well).

    Either way there’s alot to be learned from Python methinks.

    - Firefox

    Would be real nice to have an extension that allows you to right click on a download from the Firefox download manager (if the download has the right file extension / mime-type say) and install it. Again lots of work but Firefox + extension are very easy for users to set up and are cross platform. Mozilla’s XPCom also makes networking a possibility, via Javascript so having a remote installer would be possible (for someone with infinite time ;) )

    May also be possible to employ Mozilla’s extension installer XPInstall for other uses, although I expect it will restrict you to installing into the Mozilla diretory.

    A third angle, which I’m not sure could be applied but may have potential is something like they’ve done with Blogtorrent – see how it works. Seems you can “tack on” extra files on the fly, to a Nullsoft installer program. Windows only though

  7. Jeff Moore says:
    11/26/2004 at 9:07 am

    Harry, your python comment presumes that the user has command line access. I think many php installation procedures assume this, and it is not necessarily true. Especially for consumer oriented web applications (say gallery or wordpress).

    The point of “Drag and Drop” install is that there isn’t an installer. As you say: “What’s proved successful as a model for an installer is one that doesn’t need installing itself.” Indeed, part of what makes drag and drop work on the Mac, is that the environment is built for it. The question I ask is why can’t PHP streamlined for the task of installing web applications. It is without a doubt the most widely deployed language. It already has more end-user oriented software than anything else. Why can’t the PHP community now spend some effort on usability refinements to cement that leadership?

    Also, I don’t mind that an application has a online configuration stage, hopefully as minimal as possible. As long as the application can get to the configuration stage without requiring configuration. :) The goal is too minimize the number of different tools the user needs to get from step A to step B and to eliminate as many intermediate steps as possible.

  8. Stefano F. Rausch says:
    12/2/2004 at 2:50 pm

    Here are just my 2 cents: perhaps it is – for the time being – unkown that there is a php-package-maker available, which comes AFAIK near to what Jeff is looking for. Unfortunately for some of the guys out there the information is only in German. But hey, why not dive into the code?

    To make a long story short: there are two ways for installing.

    The first option needs a separate php-package-installer, which once uploaded will always install all the phinstaller-packages it will find.

    The second and more interesting option is the self-extracting-package. According to the description there are the possibilities of deleting the package after installation or the execution of a setup.php, if available.

    Well, it seems that this could be a good start for further development, does it not?

  9. Nick Clarke says:
    12/19/2004 at 7:04 am

    I just read the post and this came to mind:
    http://izforge.com/izpack/

    The only limitation would be that you have to have java installed, but it does run on the main OS’s

    Nick

  10. Jeff Moore’s Blog » Blog Archive » PEAR Channels says:
    3/7/2005 at 3:08 pm

    [...] ted in the new PEAR channels. I like where this is going. I especially like the idea of web application installers (versus library installers). [...]

  11. pacoit says:
    3/8/2005 at 6:34 pm

    I think a lot can be done and has been accomplished through various package managers and PEAR. However, I see an unfair comparison between a “Mac like” install and an install on a hosted server with limited priviledges. After all, on the Mac, you are at your computer; you have access to the console; and you have all permissions.

    Aside from that:
    1) dependencies (ie, MySQL) are ok as long as they can be installed just as easily.

    2) mimick *nix installs, with config files in user dir (ie, /home/webapps), so upgrades don’t override user config.

    3) …more

    The biggest thing may be to agree upon a standard. We’ll also need a repository with packages checked for proper build by a trusted group.

  12. The Chronicles of Stuffed Guys » Blog Archive » Self extracting web installer says:
    3/10/2005 at 9:39 am

    [...] al software Not require unarchiving (a wish, i know) Not require obscure PHP modules http://www.procata.com/blog/archives/2004/11/24/installing-web-applicati [...]

  13. Jeff Moore’s Blog » Blog Archive » Installing PEAR Based Applications says:
    4/19/2005 at 10:06 pm

    [...] I’d like to better integrate WACT with some PEAR packages. My primary concern is over the installation implications. I didn’t find a “powered by PEAR” sectio [...]

  14. another fool says:
    9/4/2005 at 7:22 pm

    In the windows world, drag-n-drop installs are generally known as “malware”. In the Mac world, it is the ideal. Go figure.

  15. Zend Framework Webcast | Professional PHP says:
    12/5/2005 at 3:29 pm

    [...] It is much better to be able to declare dependencies on individual packages, rather than on one huge bundle of components. Monolithic distribution unnecessarily ties together the release schedules of packages that might otherwise have no common dependencies. Micro-packages on a PEAR channel are the future of PHP web application installation. [...]

  16. Improving Web Application Installation as a Security Imperative | Professional PHP says:
    12/7/2005 at 10:19 pm

    [...] I’ve advocated better web application installation for a while, but as a usability issue. Increasingly, it is also a security issue. Just another example of why I think the PEAR installer is important. (and why I hope Zend PHP Framework is released on a PEAR channel.) [...]

  17. Jackie says:
    4/23/2007 at 10:43 pm

    I have a mac and I can’t find a program to set up the files I download, I have them on my computer but it seems none of the applications will run the file, is there anything you can recommend?

  18. Aaron Saray says:
    6/16/2007 at 7:46 pm

    Another thought for ease of installation would be a top down 1 long PHP script distribution (the only caveat is that it would require the user PHP/apache is running as to have write access to the file system where the script is running).

    Anyway, the theory is this: The automated tool parses the directory structure and makes a list of the php folders and files. It then brings all of the directory structure making code into the first part of this php file. Then, it brings in the code for each PHP file into the source as well. So, when you “drag and drop” the code into the location, and run it, it makes the distribution (and possibly can delete itself? I haven’t thought this idea out…)

    Then, any data could also be imported into the end (sql insertion etc…)… but this would require configuration questions as the script runs – which are still easy to do.

    Finally, any website that serves these php files would send a header of plain text for the .php files in their download section. This way, you’d get ‘aaronsAwesomeProgram.php’ with the proper extension ready to be executed (without being processed on the host machine).

    I’m sure there are errors in this – because I just thought of it off the top of my head… and I apologize if any of the packages mentioned above do this – I haven’t had a chance to check them out yet.

    Finally, as an afterthought – the mac installation – the windows installation, both are desktop environments primarily… When you’re installing something on a server, the security model is usually different (for example, the last time I installed something on a windows 2003 server, I had to run-as and authenticate as an administrator)… so, where most PHP scripts are running, they are under more strict security models as well – kind of getting rid of this whole drag and drop installation paradigm.

  19. casque monster says:
    7/26/2011 at 8:14 pm

    Mit Tiffany Schmuck wie z.B Tiffany&Co und Anhänger sieht man ziemlich true religion elegant und charakterisiert aus. Gönnen Sie sich Glaskunst von Tiffany mit günstigen Preisen in Tiffany Onlineshop.
    Tiffany & co
    Tiffany Schmuck

  20. Barabara Ped says:
    8/23/2011 at 10:28 pm

    You could certainly see your expertise in the paintings you write. The arena hopes for even more passionate writers like you who are not afraid to mention how they believe. All the time follow your heart.

  21. Kool Heads is a resource for PHP clone scripts, where all products cost only 19.95$ says:
    10/27/2011 at 3:09 am

    Kool Heads is a resource for PHP clone scripts, where all products cost only 19.95$…

    [...]Installing Web Applications – Professional PHP[...]…

  22. a2792847 says:
    11/4/2011 at 9:08 pm

    I’ve said that least 2792847 times. The problem this like that is they are just too compilcated for the average bird, if you know what I mean

  23. Ronald Deshields says:
    11/5/2011 at 10:10 pm

    useful info

  24. snow says:
    11/7/2011 at 7:04 am

    Understanding how PHP’s include path works

  25. Black Friday Britax Marathon 70 says:
    11/7/2011 at 6:55 pm

    This is my initial time i visit here. I found so many fascinating stuff in your blog especially its discussion. From the loads of comments on your articles, i guess i’m not the only one having all the enjoyment here! keep up the nice work.

  26. 775highbench says:
    11/8/2011 at 12:40 am

    hey, really awe-inspiring blog site! man gorgeous amazing i wish bookmark your weblog also reconsider the feeds conjointly.

  27. Mario Sieg says:
    11/8/2011 at 1:35 am

    helpful post

  28. Blair Speigel says:
    11/8/2011 at 3:36 am

    ok

  29. Ena Tselee says:
    11/8/2011 at 5:30 am

    I follow

  30. aboutmyzimbabwe says:
    11/8/2011 at 8:37 pm

    greeting, set up bing to ones new tender moreover it looked extrinsic but after recall everything displayed ok.

  31. a keyword research says:
    11/8/2011 at 11:38 pm

    Thanks for the great article. I have learned from this text, Love the site!

  32. blackfriday says:
    11/8/2011 at 11:50 pm

    To purchase online. This item has been discounted at this link.| Black Friday Sale Philips AS351/37 Fidelio Docking Speaker for Android | Black Friday Philips AS351/37

  33. alphaglobaltrade says:
    11/9/2011 at 10:15 pm

    hey, it’s preeminent until fancy sites with google as a phenomenon thanks since the compute that you’ve assumption. commonly, i’m real astounded, but etc.

  34. Jere Summy says:
    11/10/2011 at 7:16 am

    top post

  35. Hee Schrope says:
    11/10/2011 at 11:13 am

    I got what you intend,bookmarked , quite decent website.

  36. Elenore Bera says:
    11/10/2011 at 3:58 pm

    nice post

  37. lap-band says:
    11/10/2011 at 5:12 pm

    The ULTIMATE Weight Loss Surgery Resource

  38. Online Shopping Black Friday says:
    11/10/2011 at 9:23 pm

    After analysis variety of of the blog posts on your web site currently, and that i really like your manner of blogging. I bookmarked it to my bookmark website record and can be checking again soon. Pls strive my website online furthermore and let me apprehend what you’re thinking that.

  39. Kristine Aderholdt says:
    11/11/2011 at 4:27 pm

    nice post

  40. buy black friday says:
    11/13/2011 at 10:36 pm

    Blog content is very good and I will come back to read it as an encouragement to the other

  41. Oscar Usilton says:
    11/13/2011 at 11:39 pm

    a useful publish thanks!

  42. bailey boots uggs crystal blue for women says:
    11/17/2011 at 12:40 am

    strongzz Nice blog here! Also your website loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol

  43. Sanford Orth says:
    11/17/2011 at 5:41 pm

    Wow, great article!

  44. Chan Rosetti says:
    11/19/2011 at 3:08 pm

    good job thanks for the put up

  45. Abram Lewicki says:
    11/20/2011 at 5:39 am

    thanks for posting this data!

Leave a Reply

Click here to cancel reply.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

code: use [code=php][/code].

Comment Preview

    Subscribe Feed
    Share Subscribe to this blog…
    Share Bookmark or share this page…
  • About

    My name is Jeff Moore. I'm a PHP programmer living in San Francico and working for a startup.

    More about me…

  • Categories (Home)

    • Agile Methods (14)
    • Mac (14)
    • Misc (18)
    • Open Source (14)
    • PHP (99)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • Writing an XPath expression evaluator  7
      JDM Cars, Alva Sisk, teeth falling out dream [...]
    • PHP Games  63
      Furniture Manufacturers, Jason Pierre-Paul Jersey, Voncile Grizzel [...]
    • PDO versus MDB2  31
      Morton Deliso, Marquis Valakas, Beatriz Elifritz [...]
    • Why PHP is easier to learn than Java  48
      Betty Wager, Orville Kotrys, Esperanza Mcpeck [...]
    • Friendster wrapup: does MySQL scale  29
      Clemente Michaux, Kandra Noriego, Earl Skowronski [...]
    • Enterprise PHP  42
      Hoyt Origer, atomboygame, Luna Cerny [...]
    • Comparing PHP with other languages  38
      polštinap?eklad, polštinap?eklad, php developer [...]
    • Looking Towards the Cloud  65
      spin, Serina Doshier, Graciela Guisinger [...]
    • Working with PHP 5 in Mac OS X 10.5 (Leopard)  241
      Rory Teich, Lady Gaga, Tommy Staude [...]
    • Richard Thomas  27
      Hedwig Larcher, Carlos Cherenfant, Kurt Vagliardo [...]
  • Recent Posts

    • Richard Thomas
    • ZendCon: Writing Maintainable PHP Code
    • Looking Towards the Cloud
    • Holiday Tech Support
    • Closures are coming to PHP
    • php | tek Wrapup
    • php | tek 2008
    • Sarah Snow Stever
    • Benchmarking PHP’s Magic Methods
    • The Endpoints of the Scale of Stupidity on Video
  • Site

    • Archives
    • Log in
  • Search