>> homepage 





Note that this script is not maintained anymore. It hasn't been tested with PHP4 - it will probably not work there without modifications.

httpmanage is a PHP3 tool that provides functions to manage two versions of WWW files. It's a great help if you are often updating some, but not all, pages on a webserver or if you are not the only person working on the files. With httpmanage you can easily upload files from your development server to the online server, make diffs between these versions and keep a changelog for every file. You can also give files a certain state, e.g. "in development", "ready for upload" etc. All these functions are very easy to use - they are accessible via links shown in your HTML/PHP files.

Download httpmanage 0.4.3 (2000-05-18), 33kB

Please note that for security reasons you should only run this on a trusted development server, which also means you should have control over all files in your webroot. Also note that there's probably no reason to install it on both the development server and the online server. It's only intended for your development server.

This software is provided under the GPL, see file COPYING.


Every file that includes admin.php3 will show these links (* = requires database). Click the links to see what's happening (these are static HTML pages for demonstration only, so some commands are not linked. This doesn't show the latest version but you should get the idea):

online: /testsite/httpmanage_html/index.html in project 'httpmanage'
change state* / put online / check syntax / get online version / preview dev / view online / diff dev/online / view changes*


There are some very serious security issues:

  • Only use it on a trusted server. Configure $ips in a way only trusted people will have access to the program, since user input (e.g. filenames) is not checked.
  • You should change the default password for accessing the database
  • Your webserver and PHP usually run as user wwwrun or similar. If you put files online with scp, wwwrun must have access to the private ssh key. The key also mustn't have a password. If you use cp to put files online, wwwrun must have write access to the files on the online server. wwwrun's homedir may default to /tmp. It's probably no good idea to save an ssh key in /tmp/.ssh/.
  • admin.php3 needs a time limit of more than 30 seconds if you do things that take more time, e.g. uploading several big files a once. For this, you can increase max_execution_time in your php3.ini. The other way is to set safe_mode = Off so admin.php3 (and any other PHP script) can increase its execution time itself.


  • a webserver (tested with Apache 1.3.9)
  • PHP3 (tested with 3.0.12)
  • optional: MySQL (tested with 3.22.27) or PostgreSQL (tested with 6.5.1)

Installation on development server

(Note: You can omit the parts with the database if you set $usedb = 0 in admin.php3. Some functions will not be accessible then.)

Set up the database tables:

change the password and username in httpmanage.mysql. After that:
mysqladmin -u root -p create httpmanage
mysql httpmanage -u root -p <httpmanage.sql

su - postgres
createuser httpmanage (answer yes to the "create database" question)
psql -u httpmanage
\i httpmanage.psql (this imports the table definitions)
There are several ways to set a password, see pg_hba.conf.

Restart the database, e.g. like this:
/etc/rc.d/init.d/mysql restart or /etc/rc.d/init.d/postgres restart

Untar httpmanage-0.x.tar.gz somewhere in your webroot. Adapt the configuration in conf_testsite.php3, admin.php3 and phplib/local.inc to your needs. Make sure the directory tmp is writeable by the user your PHP scripts run under.

Now you have to include admin.php3 to all the files you want to manage. There are several ways to do this (thanks to Ulrich Babiak for pointing out the not so stupid ways):

  • The most elegant solution is probably to use mod_layout for Apache. It can append admin.php3 to any file, no matter if it's PHP, HTML or even CGI.
  • You can set auto_append_file in your php3.ini, so admin.php3 will get appended to any PHP file when it gets accessed.
  • Maybe you already have a PHP include in every page? Then you can just add include("admin.php3"); in that include (you'll have to use the correct path, of course).
  • If you need control over the exact position of the include, you'll have to touch every page and add the include by hand, still setup_include.pl can help you to automate this. You'll need to modify your httpd.conf like this (for PHP style includes):
    AddType application/x-httpd-php3 .html
    ...or like this (for SSI style includes):
    AddType text/html .shtml
    AddHandler server-parsed .shtml
    Also make sure that Options in <Directory> contains at least Includes.

If you use ssh/scp to upload/download files you must have run ssh/scp at least once as user wwwrun (or whatever your PHP scripts run under, e.g. nobody), so the server you connect to is in wwwrun/nobody's known_hosts file.

Now you're ready to test it: Go to one of the files that includes admin.ph3 and you should see all the links that httpmanage provides. If it doesn't work, there's probably a problem with one of the three files where configuration takes place. Try to set $usedb = 0 (in admin.php3) to see if the problem is database related.

Installation on online server

You don't have to install anything on the online server. You only have to make sure that the included file doesn't do any harm, i.e. it mustn't show up for the user. If the paths to admin.php3 are the same on the development server and on the online server, you may want to put up admin-online.php3 as admin.php3. It gets included but doesn't do/show anything.


I cannot use diff, PHP says "no route to host".
Maybe you are forced to use a proxy? Unfortunately, PHP has no proxy support. You'll have to wait for a a future version of httpmanage that supports a diff on files it gets via scp (or try to add it yourself, it's not difficult).


For a more complete list of changes see the comments in the program itself.

Release Notes for 0.4.3 / Changes compared to 0.4.2:

  • fixed a typo that made it impossible to upload several files at once

Release Notes for 0.4.2 / Changes compared to 0.4.1:

  • fixed a broken SQL query

Release Notes for 0.4.1 / Changes compared to 0.4:

  • small bugfixes (wrong links)

Release Notes for 0.4 / Changes compared to 0.3:

  • I recommend to update to this version because of a security fix (the temporary file issue - now the system wide /tmp directory isn't used anymore)
  • PostgreSQL can be used instead of MySQL (thanks to PHPLib)
  • bug fixes and cleanups
  • an improved diff command can now optionally ignore the differences between \n and \r\n line endings
  • Please see the script itself for known problems (admin.php3).

Release Notes for 0.3:

  • If you upgrade from an older version, you have to add a new database column:
    mysql httpmanage_x --user=httpmanage -p -e "ALTER TABLE files ADD date datetime"
    where httpmanage_x is the name of your database.
  • If you have several projects with different configurations, use one database for each project
  • Since uploading several files might take more than 30 seconds, which is the default time limit, you may need to set safe_mode = Off in your php3.ini. See security section.
  • To see what's TODO, see the script itself (admin.php3).
  • Changes against 0.2:
    handle any type of file (images, sounds, just anything in your webroot); warn if a file with state 'online' has been changed after the latest upload; form to give username and comment for upload; upload several files at once; no more index.html (now included in admin.php3); fixes and minor cleanups
naber (at) danielnaber de, Last updated: 2001-08-03
URL: http://www.danielnaber.de/httpmanage/