A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearWhat are best practices for self-updating PHP+MySQL applications? - page 1
User InfoPosts
What are best practices for self-updating PHP+MySQL applications?#1
It is pretty standard practice now for desktop applications to be self-updating. On the Mac, every non-Apple program that uses Sparkle in my book is an instant win. For Windows developers, this has already been discussed at length. I have not yet found information on self-updating web applications, and I hope you can help.

I am building a web application that is meant to be installed like Wordpress or Drupal - unzip it in a directory, hit some install page, and it(s ready to go. In order to have broad server compatibility, I(ve been asked to use PHP and MySQL -- is that **MP? In any event, it has to be broadly cross-platform. For context, this is basically a unified web messaging application for small businesses. It(s not another CMS platform, think webmail.

I want to know about self-updating web applications. First of all, (1) is this a bad idea? As of Wordpress 2.7 the automatic update is a single button, which seems easy, and yet I can imagine so many ways this could go terribly, terribly wrong. Also, isn(t the idea that the web files are writable by the web process a security hole?

(2) Is it worth the development time? There are probably millions of WP installs in the world, so it(s probably worth the time it took the WP team to make it easy, saving millions of man hours worldwide. I can only imagine a few thousand installs of my software -- is building self-upgrade worth the time investment, or can I assume that users sophisticated enough to download and install web software in the first place could go through an upgrade checklist?

If it(s not a security disaster or waste of time, then (3) I(m looking for suggestions from anyone who has done it before. Do you keep a version table in your database? How do you manage DB upgrades? What method do you use for rolling back a partial upgrade in the context of a self-updating web application? Did using an ORM layer make it easier or harder? Do you keep a delta of version changes or do you just blow out the whole thing every time?

I appreciate your thoughts on this.

posted date: 2009-04-06 16:58:00


Re: What are best practices for self-updating PHP+MySQL applications?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-06 16:58:01


Re: What are best practices for self-updating PHP+MySQL applications?#3
Frankly, it really does depend on your userbase. There are tons of PHP applications that don(t automatically upgrade themselves. Their users are either technical enough to handle the upgrade process, or just don(t upgrade.I purpose two steps:1) Seriously ask yourself what your users are likely to really need. Will self-updating provide enough of a boost to adoption to justify the additional work? If you(re confident the answer is yes, just do it.Since you(re asking here, I(d guess that you don(t know yet. In that case, I purpose step 2:2) Release version 1.0 without the feature. Wait for user feedback. Your users may immediately cry for a simpler upgrade process, in which case you should prioritize it. Alternately, you may find that your users are much more concerned with some other feature.Guessing at what your users want without asking them is a good way to waste a lot of development time on things people don(t actually need.

posted date: 2009-04-06 17:23:00


Re: What are best practices for self-updating PHP+MySQL applications?#4
I suppose you(ve already ruled this out, but you could host it as a service. (Think wordpress.com)

posted date: 2009-04-06 17:25:00


Re: What are best practices for self-updating PHP+MySQL applications?#5
I have not ruled it out at all; we want to do both, actually.

posted date: 2009-04-06 17:29:00


Re: What are best practices for self-updating PHP+MySQL applications?#6
I had asked a similar question a while ago that might be helpful.

posted date: 2009-04-06 17:33:00


Re: What are best practices for self-updating PHP+MySQL applications?#7
I think your best option is an update checking mechanism that will alert the administrator when there are update(s).As you mention, there are a number of potential security problems. Due to those alone, I would suggest not doing this. Instead, try creating a fairly smart upgrading script.

posted date: 2009-04-06 19:08:00


Re: What are best practices for self-updating PHP+MySQL applications?#8
I(d suggest that you package your application with pear and set up a channel. Your users can then upgrade the application through a standard interface (pear). It(s not entirely automatic (unless the users have some kind of automation running on top of pear), but it(s standard, so any sysadmin can maintain it.

posted date: 2009-04-07 00:24:00


Re: What are best practices for self-updating PHP+MySQL applications?#9
Just my 2 cents: I(d consider an automatically self updating application within my CMS as a security hole, so if you decide to code this feature, you should consider to implement different levels of this behavior:Automatically updateCheck for updates and notifyDisable

posted date: 2009-04-07 02:44:00


Re: What are best practices for self-updating PHP+MySQL applications?#10
I(ve been thinking about this lately in regards to database schema changes. At the moment I(m digging into WordPress to see how they(ve handled database changes between revisions. Here(s what I(ve found so far:$wp_db_version is loaded from wp-includes/version.php. This variable corresponds to a Subversion revision number, and is updated when wp-admin/includes/schema.php is changed. (Possibly through a hook? I(m not sure.) When wp-admin/admin.php is loaded, the WordPress option named db_version is read from the database. If this number is not equal to $wp_db_version, wp-admin/upgrade.php is loaded.wp-admin/includes/upgrade.php includes a function called dbDelta(). dbDelta() scans $wp_queries (a string of SQL queries that will create the most recent database schema from scratch) and compares it to the schema in the database, altering the tables as necessary so that the schema is brought up-to-date.upgrade.php then runs a function called upgrade_all() which runs specific upgrade_NNN() functions if $wp_db_version is less than target values. (ie. upgrade_250(), the WordPress 2.5.0 upgrade, will be run if the database version is less than 7499.) Each of these functions run their own data migration and population procedures, some of which are called during the initial database setup script. Nicely cuts down on duplicate code.So, that(s one way to do it.

posted date: 2009-04-07 09:49:00


Re: What are best practices for self-updating PHP+MySQL applications?#11
great question. I think self upgrading not only cuts down on install hours, but gives you the ability to fix distributed security issues on the fly. so many open source applications get mass exploited once a security hole is found. but you are right, there are so many things that could go wrong. what if the user customizes their code for one?

posted date: 2012-02-17 12:24:00


Re: What are best practices for self-updating PHP+MySQL applications?#12
Yes it would be a security feature if PHP went and overwrote its files from some place on the internet with no warning. There(s no guarantee that the server is connecting correctly to your update server (it might download someone code crafted by someone else if DNS poisoning occured) - giving someone else access to your client(s data. Therefore digital signing would be important. The user could control updates by setting permissions on the web directory so that PHP only has read access to the files - this procedure could simply be documented with your program. One question remains (I really don(t know the answer to): can PHP overwrite files if it(s currently using them (e.g. if the update.php file itself needed to be updated)? Worth testing.

posted date: 2012-05-23 02:26:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.