web:mirror
no way to compare when less than two revisions

Differences

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


Previous revision
Next revision
web:mirror [2012/06/05 11:03] – use git bjori
Line 1: Line 1:
 +==== How to create a PHP.net mirror ====
  
 +Setting up an official (or unofficial) mirror is described within [[http://php.net/mirroring.php|the official mirror page]]. However, setting up your own mirror via SVN is possible too and is especially helpful for those working on the PHP website.
 +
 +=== I'm lazy. Just give me something to execute ==
 +Save the following shell script as IcanHazPHPWeb.sh
 +Then execute sh ./IcanHazPHPWeb.sh
 +And wait for ca 10 minutes. (took 7m30.871s on my box)
 +
 +<code shell>
 +#!/bin/sh
 +mkdir ~/php.net
 +cd ~/php.net
 +
 +# Checkout the english manual sources
 +svn co https://svn.php.net/repository/phpdoc/modules/doc-en
 +# Checkout the actual website (does not include /distribution, thats a gigantic separate repo)
 +git clone git://git.php.net/web/php.git phpweb
 +cd phpweb
 +
 +# Some files are pre-generated on master.php.net for various reasons
 +(cd include && for i in countries.inc last_updated.inc mirrors.inc pregen-confs.inc pregen-events.inc pregen-news.inc; do wget "http://www.php.net/include/$i"; done;)
 +(cd backend && for i in ip-to-country.db ip-to-country.idx; do wget "http://www.php.net/backend/$i"; done;)
 +cd ..
 +
 +
 +# Install PhD and build the manual
 +cd doc-en
 +php doc-base/configure.php
 +pear install doc.php.net/phd_php
 +phd -d doc-base/.manual.xml -P PHP -f php
 +cd ..
 +
 +cd phpweb
 +# Symlink the generated english documentations from our PhD build dir
 +(cd manual && ln -s ~/php.net/doc-en/output/php-web en)
 +
 +echo "Now copy&paste the VirtualHost config from http://php.net/mirroring.php#settings"
 +echo "Fill out the 'template' and restart apache"
 +</code>
 +
 +Note: To see the "new look", add ?beta=1 after the url, or enable the cookie from /my.php
 +
 +
 +=== The SVN way, but with a hack ===
 +
 +  - Checkout phpweb (svn co https://svn.php.net/repository/web/php/trunk phpweb)
 +  - Within phpweb, run this: <code php>
 +<?php
 +// Note: This is a complete hack
 +// Mirror to steal from
 +$mirror = 'http://www.php.net/';
 +
 +// Files phpweb needs (typically from rsync box)
 +$files = array('include/mirrors.inc', 'include/countries.inc', 'include/pregen-events.inc', 'include/pregen-news.inc', 'include/pregen-confs.inc');
 +
 +foreach ($files as $file) {
 + file_put_contents($file, file_get_contents($mirror . $file));
 +}
 +
 +// Another required file, let's create it ourselves
 +file_put_contents('include/last_updated.inc', '<?php $LAST_UPDATED=' . time() . '; ?>');
 +?>
 +</code>
 +  - Make a virtual host, see [[http://php.net/mirroring.php|The official mirror page]]
 +  - If wanting the PHP Manual too, either:
 +    * [[doc:howto|Build it]]
 +    * Rsync it
 +    * Download it
web/mirror.txt · Last modified: 2023/12/05 12:17 by derick