doc:articles:localdocsetup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
doc:articles:localdocsetup [2011/06/04 22:24] – initial _rough_ (seriously) draft philipdoc:articles:localdocsetup [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Checking outbuilding, and viewing the PHP documentation on an unofficial php.net mirror ====== +This page has been removed, in favor of [[http://doc.php.net/tutorial/local-setup.php|new guide]]
- +
-Viewing results as a php.net mirror isn't a simple process, but it can be done. The following is one route, and it assumes: +
- +
-  * PHP 5.3+ is available +
-  * A web server, specifically (in this example) Apache +
-  * The **rsync** tool is available +
-  * A basic level of shell/terminal usage, or know that shell commands follow a **$** below +
-  * A desire to build and display the documentation locally +
-  * Your PHP Documentation path will be: **/tmp/svn/doc-en** +
-  * Your local mirror path will be: **/home/sites/myphpnet/** +
-  * Your local hostname will be: **http://mydocs.site/** +
-  * You are using Linux or a Mac (@todo Make this guide Windows friendly) +
- +
-If you're interested in simply setting up a local PHP mirror (and NOT build the documentation) then simply follow the php.net mirroring guidelines and ignore this document. +
- +
-===== Checkout the php documentation from SVN ===== +
- +
-Assumptions: This assumes using /tmp as the root directory, and checkout of the English language. Adjust accordingly. +
- +
-==== Option #1 : Traditional ==== +
-<code shell> +
- $ mkdir /tmp/svn +
- $ cd /tmp/svn +
- $ svn co http://svn.php.net/repository/phpdoc/modules/doc-en doc-en +
- $ cd /tmp/svn/doc-en +
-</code> +
-==== Option #2 : Automated ==== +
-<code shell> +
- $ cd /tmp +
- $ wget http://svn.php.net/repository/phpdoc/doc-base/trunk/scripts/create-phpdoc-setup.php +
- $ php create-phpdoc-setup.php -h +
- $ php create-phpdoc-setup.php -b /tmp/svn -l en +
- $ cd /tmp/svn/doc-en +
-</code> +
-===== Validate the PHP Documentation XML ===== +
-<code shell> +
- $ cd /tmp/svn/doc-en +
- $ php doc-base/configure.php +
-</code> +
-===== Build the documentation ===== +
- +
-We use PhD to build the documentation. It takes the source that configure.php generates, and builds and formats the PHP documentation. PhD offers several formats including HTML (multiple or single page), PDF, Man, Epub, and others, including PHP which is what we use at php.net.  +
- +
-==== Install PhD ==== +
- +
-=== Option #1 : Traditional === +
- +
-Requirements: PEAR, and an SSL enabled PHP version greater than 5.3.0. +
-<code shell> +
- $ pear install phpdocs/PhD +
- $ pear install phpdocs/PhD_Generic phpdocs/PhD_PHP +
- $ phd --help +
-</code> +
-=== Option #2 : Automated === +
- +
-The create-phpdoc-setup.php installs PhD. +
- +
-==== Use PhD to build the documentation ==== +
-<code shell> +
- $ cd /tmp/svn/doc-en +
- $ php doc-base/configure.php +
- $ phd --docbook /tmp/svn/doc-en/doc-base/.manual.xml --package PHP --format php --output mydocs +
- $ cd /tmp/svn/doc-en/mydocs/php-web/ +
- $ ls +
-</code> +
- Note: This builds the php.net version of the documentation, but does not contain the files and includes used to run php.net. In other words, files like the php.net headers and footers are not built by PhD and are instead stored in a separate SVN module (web/php). +
- +
- Alternative: The XHTML format is an alternative approach to the PHP format, and displays manual pages as plain HTML files. To run that: +
-<code shell> +
-   $ phd --docbook /tmp/svn/doc-en/doc-base/.manual.xml --package PHP --format xhtml --output mydocs +
-   $ cd /tmp/svn/doc-en/mydocs/php-chunked-xhtml/ +
-   $ open strlen.html  +
-</code> +
-===== Setup a local php.net mirror ===== +
- +
-==== Setup an Apache virtual host ==== +
- +
-The official PHP mirroring documentation contains a detailed example for doing this, but here's a simpler example: +
- +
-==== Download (rsync) the php.net files ==== +
- +
-<code shell> +
-  $ rsync -avzC --timeout=600 --delete --delete-after --exclude='manual/**' --exclude='distributions/**' --exclude='extra/**' --exclude='backend/notes/**' rsync.php.net::phpweb /home/sites/myphpnet/ +
-</code> +
- +
-==== Symlink (or move) the generated PHP documentation to your local php.net sources ==== +
- +
-<code shell> +
-  $ ln -s /tmp/svn/doc-en/mydocs/php-web /home/sites/myphpnet/manual/en +
-</code> +
- +
-==== Configure Apache ==== +
- +
-  * Open the apache configuration file (e.g., apache.conf, httpd.conf, apache/conf.d/virtualhosts/myphp.site, ...) +
-  * Add the virtual host: +
- +
-<code> +
-<VirtualHost *> +
-     <Directory /home/sites/myphpnet> +
-          Options -Indexes -MultiViews +
-     </Directory> +
- +
-     ServerName myphp.site +
-     DocumentRoot /home/sites/myphpnet/ +
-      +
-     # Set directory index +
-     DirectoryIndex index.php index.html +
-      +
-     # Handle errors with local error handler script +
-     ErrorDocument 401 /error.php +
-     ErrorDocument 403 /error.php +
-     ErrorDocument 404 /error.php +
-      +
-     # Add types not specified by Apache by default +
-     AddType application/octet-stream .chm .bz2 .tgz .msi +
-     AddType application/x-pilot .prc .pdb  +
- +
-     # Set mirror's preferred language here +
-     SetEnv MIRROR_LANGUAGE "en" +
- +
-     RemoveHandler var +
-      +
-     # Turn spelling support off (which would break URL shortcuts) +
-     <IfModule mod_speling.c> +
-       CheckSpelling Off +
-     </IfModule> +
-</VirtualHost> +
-</code> +
- +
-  * Adjust /etc/hosts by adding the following:   +
-<code> +
-    127.0.0.1    myphp.site +
-</code> +
-  * Restart Apache +
-<code shell> +
-    $ sudo apachectl restart +
-</code> +
-===== View the new site ===== +
- +
-  * http://mydocs.site/manual/en/ +
doc/articles/localdocsetup.1307226241.txt.gz · Last modified: 2017/09/22 13:28 (external edit)