README 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. Installing GitPHP
  2. Minimum requirements:
  3. git
  4. Apache (or other php-compatible webserver)
  5. PHP 5
  6. To begin, you need to have your git repositories set up in a directory that the
  7. webserver can access. They can be in subdirectories within that, but you will
  8. need a base directory to tell GitPHP where to look for repositories. These
  9. must be bare repositories - for those who don't know, the directory of source
  10. code you have is your working copy, and the .git hidden directory inside of that
  11. is the actual repository, which is what GitPHP reads. There are files in here
  12. like HEAD, COMMIT_EDITMSG, description, etc.
  13. You can make a copy of your bare repository by running:
  14. git clone --bare ~/myproject /gitprojects/myproject.git
  15. Or, a new bare repository can be initialized with:
  16. git init --bare /gitprojects/mybareproject.git
  17. Once you have your projects in a directory, something like:
  18. /gitprojects/project1.git
  19. /gitprojects/project2.git
  20. /gitprojects/subdir/project3.git
  21. You can begin setting up GitPHP. Put the GitPHP files in a place
  22. readable by your webserver. You will need to change the permissions of the
  23. templates_c directory to be writable by your webserver. This can be done
  24. by either:
  25. chown apache:apache templates_c
  26. (assuming your webserver runs as user/group apache - this is the better way)
  27. or:
  28. chmod 777 templates_c
  29. Then, you will need to set up your config file. In the config directory,
  30. copy the example config file, gitphp.conf.php.example, to gitphp.conf.php.
  31. The only required setting is the 'projectroot' setting, which specifies
  32. where your git repositories are - following the previous example, it would
  33. be set up as "/gitprojects/".
  34. All the available config options and their default settings are documented
  35. in gitphp.conf.defaults.php. If you want to change any of the settings,
  36. just copy the config option from the defaults file to your normal config
  37. and change the setting. Some GitPHP features are disabled by default
  38. since they require setting config options a certain way, so if you don't
  39. look through the config file you won't get those features.
  40. During upgrades, your existing config file will not be overwritten. However
  41. new options or features may be added to the defaults file, so you may want
  42. to check for new options every now and then.
  43. If you want to set up categories for your projects, or use a text file
  44. with a list of projects, you need to set up the $git_projects array in
  45. projects.conf.php. Copy projects.conf.php.example to projects.conf.php
  46. and edit it - the definition and structure of this is explained in
  47. the config file.
  48. If you want to edit the text header that appears above the project list on the
  49. home page, create templates/hometext.tpl with your header content.
  50. [Caching]
  51. To turn on caching, set the 'cache' config item to true. Gitphp will cache
  52. every page's output, including plaintext output and binary output such as
  53. blobs and snapshots, for the number of seconds specified in the
  54. 'cachelifetime' config key. You will need to set the "cache" directory
  55. writable by the server, as with the templates_c directory above.
  56. Gitphp can also cache immutable objects from the git repository, by setting
  57. 'objectcache' to true. These cached objects can be reused on multiple
  58. pages. The 'objectcachelifetime' config key controls how long they are
  59. cached. Since these objects don't ever change in the git repository, they
  60. can be cached for significantly longer than templates can (or in theory,
  61. forever). This option can be used on its own, or in addition to the regular
  62. template 'cache' option for the maximum benefit. This option also requires
  63. the "cache" directory writable by the server, as above.
  64. The 'cacheexpire' key is recommended for most users. With this option on,
  65. gitphp will attempt to keep the cache in sync by automatically expiring any
  66. cached pages that are older than the most recent commit, on any branch.
  67. It is a slight performance hit to make this check, but the performance hit
  68. is tiny compared to the gain you get from turning on caching. It will
  69. avoid situations where users are getting a cached version of a page that
  70. isn't up to date and doesn't reflect the most recent commit, or worse,
  71. pages that have been cached at different times and show data from both
  72. before and after a commit (eg page 1 of the shortlog shows the most recent
  73. commit but page 1 of the log was cached a while ago and doesn't show the
  74. most recent commit).
  75. However, if your project is so active that commits are constantly coming in
  76. and invalidating the cache, rendering it useless, it would be better to
  77. turn cache expiration off and just set a really short cache lifetime of
  78. a few seconds. In other words:
  79. Most users:
  80. * Set 'cache' to TRUE
  81. * Set 'objectcache' to TRUE
  82. * Set 'cacheexpire' to TRUE (this is the default)
  83. * Set 'cachelifetime' high, 3600 seconds (1 hour) or more. (3600 is the default)
  84. * Set 'objectcachelifetime' even higher, eg 86400 seconds or more. (86400 is
  85. the default)
  86. These are the defaults.
  87. Extremely active projects, with commits every few seconds, or advanced
  88. users that know exactly how often commits come in and want to save
  89. the performance of the expiration check:
  90. * Set 'cache' to TRUE
  91. * Set 'objectcache' to TRUE
  92. * Set 'cacheexpire' to FALSE
  93. * Set 'cachelifetime' low, between 5-10 seconds.
  94. * Set 'objectcachelifetime' high, 86400 seconds or more. (86400 is the default)