Installation
Requirements
PHPDoc requires PHP3.0.8+. PHP4.0.3+ is suggested. The following
extensions must be enabled:
PCRE is build in to PHP3 and PHP4 by default. XML/Expat is build into PHP4 by default but not into PHP3.
Please let me know if you have problems with certain PHP versions.
Steps
Version 1.0beta does not come with any installation tool or graphical user interface. It's
likely that further version will improve the usability. Currently you have to do
these steps:
- Download PHPDoc
- unzip the file
- tune your php.ini to allow long runtimes
- configure index.php4
- set the maximum execution time
- set PHPDOC_INCLUDE_DIR and LINEBREAK
Tuning the php.ini
PHPDoc is not very fast. A PII-500 needs slighly more than 30 seconds
for 10.000 lines of code (PHPDoc: ~10.500loc). 30 seconds is the default value for
the maximum execution time in the php configuration file which is
usually named php.ini for PHP4 and php3.ini for PHP3. That means it's likely
that PHPDoc will not be able to document itself if you don't change the default
value. By the way on my development server "KROETE" which is an AMD5x86-133 (~P75)
running windows the documentation of PHPDoc takes about 350 seconds.
Snippet from my php.ini
|
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 480 ; Maximum execution time of each script, in seconds (UNIX only)
memory_limit = 8388608 ; Maximum amount of memory a script may consume (8MB)
|
Edit your php.ini (max_execution_time)
file or use set_time_limit()
to set whatever maximum execution time you need. See the above figures to get an idea of how much time a certain task needs.
I suggest at least 60 seconds for PIII, 120 seconds for PII/Netra T1, 240 seconds for PI-200 machines and 480 seconds for relatives of KROETE.
Configuring index.php4
The script needs two constants to be defined:
Head of index.php4
|
// Directory with include files
define("PHPDOC_INCLUDE_DIR", "c:/www/apache/doc/");
// Important: set this to the Linebreak sign of your system!
define("LINEBREAK", "\r\n");
|
PHPDOC_INCLUDE_DIR is used in prepend.php which includes all the files that build PHPDoc (about 50). Depending
on your system it contains an absolute or relative path to the PHPDoc installation directory. In Most cases
you can't go wrong when you use a full (absolute) path e.g. c:/www/apache/phpdoc/... or /home/www/servers/... .
LINEBREAK is used by the XMLReader/XMLWriter to distinguish between line breaks and simple carriage return (\r)
or line feed (\n) characters without any special meaning to PHPDoc.
If you don't know the line break sign on your system create a file containing one
and read out the file using fopen(),
ord() and
substr().
This is a good exercise for beginners anyway ;-). Please tell me
what you have found out, so that we can have a table here with your results.
Configuration is finished now.
See the section on the usage for an example
on how to let PHPDoc document itself.
<< Introduction | Usage >>