PHP Script Installations Suck

Jul
31
2006

After the hundreds and hundreds of PHP scripts I've installed over the last 6 years or so, one thing has become abundantly clear: PHP script authors write scripts that absolutely suck to install (yes, I'm guilty too). What's strange is how often the sucky installation actually *includes* an installation procedure yet the user still ends up doing the exact same song and dance as if there hadn't been one. That would be OK if it wasn't easily within reach to make these things simple.

As more and more people start using PHP scripts, they are being installed by non-geeks. Regular folks are getting into web publishing and blogging. Having to load an SQL statement from the commandline is NOT a reasonable thing to ask a non-technical user to do. And, it's actually not a terribly reasonable thing to make anyone do. Scripting the exact same thing (load this .sql file into this database) takes no more than about 10 lines of code.

So, here's my PHP script installation solution and suggestions. I didn't write it out in code because it still does require implementation in each script. However, paying attention to these concepts will dramatically improve your PHP script installation process.

What's Required for a Typical PHP Script:

  • A place to store configuration information
  • The actual configuration information
  • An initial load of data into a database
  • A way for the rest of the script to know whether the installation has already happened and a way to trigger the install if not.

What's Required to Make it Easy:

  • Minimal changes to the filesystem.
  • Robust handling of errors when things don't go right
  • Ask the user for the bits that they need to provide.
  • Parse out and prepopulate anything that can be fetched directly from the environment.
  • Never make the user do anything that can be done directly by the script itself.
  • Uploading a new version over the top of an installed version should NOT overwrite configuration settings.

Basically, all someone should have to do is upload the script, make sure that the one place on the filesystem is writable and the rest should happen via the browser by hitting the script's URL.

 

Comments on this post

Feedback is always welcome. Read some from other folks or leave your own below. Just keep things civil and remember that what you post lives on in public. Forever.

Thanks,
J

Leave Your Own Comment

By submitting a comment, you agree to license it under the terms of the Creative Commons Attribution license.

© 2003-2008 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.