Posted by: Josh | June 23, 2010

phpHgAdmin Web Mercurial Repository Manager

Formerly “Hg-PHP”, phpHgAdmin is the re-branded v1.1.x release of the Mercurial repository management project.

The minor version bump is for

  • extended support for special characters in config files
  • multi-profile support, so multiple hgweb.config files can be maintained from one phpHgAdmin installation
  • user interface can be completely controlled by a theme pack, with a WordPress look & feel
  • significantly cleaned and re-structured, with caching
  • install utility: phpHgAdmin config validator

Upgrade instructions: recommend a fresh install. v1.1 now uses the ‘paths’ group instead of ‘collections’ in hgweb.config. These changes should be manually carried out. You should manually repair the hgweb.config file. An entry:

/path/to/repo/name = name

should now be referred to as

name = /path/to/repo/name

You still get all the same benefits from the previous 1.0 release

  • create and delete repositories
  • edit individual repository (hgrc) config in real-time
  • optimistic concurrency control: safeguard against unintentional config overwrites
  • translations-ready for your language


  • Installation of Mercurial, serving repositories with it’s web interface (basic installation and setup instructions )
  • Server write permissions to Mercurial’s web repo registry, typically “hgweb.config”
  • Server write permissions to where repositories are held
  • Server write permissions to a local scratch space (installation default is the included ‘lock’ directory)

phpHgAdmin features much looser installation requirements. hgweb.config and the repositories folder no longer need to live in the same directory as they did in v1.0.x.

  1. Extract the v1.1.x zip archive.
  2. All the files within the /admin folder (including .htaccess) can be placed in your web root directory, or a subdirectory of your web server.
  3. Edit the /admin/application/config/phphgadmin.php configuration script, making changes where appropriate with basic PHP syntax. Full documentation on configurable items are within this file.
  4. Edit the .htacess file if necessary, i.e. to impose basic HTTP authentication or if installing anywhere other than as a subdirectory named ‘admin’ .
  5. Access checkinstall.php from your web browser. This script resides at the root level of the phpHgAdmin install. This script can be deleted from the web server at any time. When all tests pass, this indicates your installation of phpHgAdmin is ready to use!
  • Mercurial reports “the specified repository is unknown” or similar error when accessing pages of phpHgAdmin: Edit the .htaccess file which resides with index.php, looking for the lines containing “admin/index.php”. This configuration works when phpHgAdmin is installed ashttp://yourdomain/admin/. Fix accordingly.

Also special thanks to Daniel (dacon) whose feedback helped push this project past v1.0 😛

And as always, your feedback is much appreciated and taken into consideration when planning the next version!

Edit: FAQ, special thanks.


  1. Nice, this was pretty much exactly what I was looking for – fair enough it does not have issue tracking, as many of the publically run sites do, but that is not such an issue, as I can use an external issue tracking script for that purpose.



  2. Yeah, there are plenty of fine issue tracking web apps like MantisBT (which I use myself). phpHgAdmin can authenticate using another web app’s login system, but I haven’t looked into it much yet.

  3. Thank you very much for creating this very useful piece of software. This saves me from having to get a more expensive hosting solution to run a Mercurial repository.

    I ran across a problem in my installation that’s simply a minor irritation and not something that prevents me from using the application. I found that I need to add a slash at the end of the default repository location in the administration tool to avoid getting an ugly Python error.

    Is the issues tab on the project’s bitbucket page the best place to create a more detailed bug report?

  4. i’m trying to setup phpHgAdmin and I’m getting a 500 internal server error when it hits the htaccess file in the root directory. my setup is as follows:

    is this correct? i figured it was throwing an error because of the file/folder permissions or that i don’t have authority to run .cgi scripts from the cgi-bin directory. any thoughts? if you need the password for (protected dir), please let me know.


  5. “Mercurial reports “the specified repository is unknown” or similar error when accessing pages of phpHgAdmin: Edit the .htaccess file which resides with index.php, looking for the lines containing “admin/index.php”.”

    I have done this and have the app installed at but it still throws this error 😦

    RewriteRule ^(.*)$ admin/index.php/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ admin/index.php/$1 [L]

  6. great tool!

    found one problem:
    if .hgignore is used (hidden file) the repo can not be deleted. glob in recursiveDelete maybe?

    I have no php skills so i delete it manually (or disable hgignore before deleting) which works for me but would be nice if it worked..

    just a thought…..


  7. great toot, but why is it not possibile to use repository names with ‘.’ inside? I tried to disable the check at line 1077 from:

    return ( ! preg_match(“/^([-a-z0-9_-i])+$/i”, $str)) ? FALSE : TRUE;


    return ( ! preg_match(“/^([-a-z0-9_-i.])+$/i”, $str)) ? FALSE : TRUE;



    I’m not a regexp expert, but repository with dots creation works. When I try to access the project (ie: aaa.bbb), on the contrary, page https://localhost/admin/hgdir simply reloads.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: