Rsyncing the PHP manual


… for the impatient

Sometimes I can’t be patient enough to wait an extra few seconds for the php manual on one of the mirrors to come back with my search results. So I have the manual on my local dev box and rsync it once a day with the live manual. This is how I have setup my dev box….. pretty straight forward :)

Setup a virtual host

<virtualhost 127.0.0.1>
ServerName kangaroo.phpmanual
ServerAdmin jeffery@ivt.com.au

# Webroot of PHP mirror site
DocumentRoot /home/jeffery/var/www/phpmanual

# These PHP settings are necessary to run a mirror
php_value include_path .:/home/jeffery/var/www/phpmanual/include
php_flag register_globals on

# Log server activity
ErrorLog logs/error_log
TransferLog logs/access_log

# Set directory index
#DirectoryIndex index.php index.html

# Do not display directory listings if index is not present,
# and do not try to match filenames if extension is omitted
Options -Indexes -MultiViews

# 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
AddType application/x-pilot .prc .pdb 

# Set mirror's preferred language here
SetEnv MIRROR_LANGUAGE "en"

# The next two lines are only necessary if generating
# stats (see below), otherwise you should comment them out
#Alias /stats/ /path/to/local/stats/
#SetEnv MIRROR_STATS 1

# Apache2 has 'AddHandler type-map var' enabled by default.
# Remove the comment sign on the line below if you have it enabled.
# RemoveHandler var

# Turn spelling support off (which would break URL shortcuts)
<ifmodule mod_speling.c>
CheckSpelling Off
</ifmodule>
</virtualhost>

Rsync the manual

Now in order to get the copy of the PHP manual onto your dev box, you need to fetch it form the PHP website servers. For this we will use the rsync protocol as the files are served through this protocol. Execute the following command on the shell:

rsync -avzC --timeout=600 --delete --delete-after \\
--include='manual/en/' --include='manual/en/**' --exclude='manual/**' \\
--exclude='distributions/**' --exclude='extra/**' \\
--include='distributions/*.exe' \\
rsync.php.net::phpweb /home/jeffery/var/www/phpmanual
This entry was posted in PHP. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">