1<?php 2$_SERVER['BASE_PAGE'] = 'mirroring.php'; 3include_once __DIR__ . '/include/prepend.inc'; 4$SIDEBAR_DATA = ' 5<h3>Existing mirror sites</h3> 6<p> 7 Properly working mirror sites are listed on <a href="/mirrors.php">our 8 mirrors page</a>. 9</p> 10'; 11/* 12<h3>SVN repository mirroring</h3> 13<p> 14 If you are interested in using a local copy of our 15 SVN repository for yourself, we provide 16 <a href="/svnsync.php">svnsync instructions</a> 17 separately. 18</p> 19'; 20*/ 21 22site_header( 23 'Mirroring The PHP Website', 24 [ 25 'current' => 'community', 26 'layout_span' => 12, 27 ], 28); 29 30?> 31<h1>Mirroring The PHP Website</h1> 32 33<p> 34 The PHP project does not have an official mirror program anymore, but you can 35 set-up a mirror for your own network or company. 36</p> 37 38<p> 39 You should not synchronize from our network more frequently 40 than once every six hours, or you may find your IP blocked. Also, please make 41 an effort to only mirror those parts of the site that you actually need. 42 (For example, <a href="#exclude">exclude the manual in all languages that you 43 will not be using and exclude the distributions directory</a>.) 44</p> 45 46<h2>Get Files With Rsync</h2> 47 48<p> 49 First, you need to have a <a href="http://rsync.samba.org/">rsync</a> 50 installed. 51 To synchronize your server with the appropriate rsync location, first view the <a 52 href="/images/oidk.net-rsync-distribution-plan-may2012.png">coverage map</a> 53 and identify which location your mirror should be using. Next, modify the 54 following code for use with your mirror. Replace <code>YOUR_RRN_HOSTNAME</code> 55 with your RRN's hostname as indicated by the coverage map and be sure to 56 change <code>/your/local/path</code> with the path to where your php.net 57 mirror will reside on the filesystem. 58</p> 59 60<pre class="info"> 61 rsync -avzC --timeout=600 --delete --delete-after \ 62 --include='distributions/*.exe' \ 63 YOUR_RRN_HOSTNAME::phpweb /your/local/path 64</pre> 65 66<a name="exclude"></a> 67<p> 68 If you only want to mirror mirror one language of the manual? Add: 69</p> 70 71<pre class="info"> 72 --include='manual/en/' --include='manual/en/**' --exclude='manual/**' --exclude='distributions/manual/**' 73</pre> 74 75<p> 76 after <code>"--delete-after"</code> in the command line above (substituting your 77 prefered language code in place of <code>'en'</code>). You can also exclude the 78 whole distributions directory (and the related extra folder) by replacing 79 <code>"--exclude='distributions/manual/**'"</code> with 80 <code>"--exclude='distributions/**' --exclude='extra/**'"</code>. 81</p> 82 83<p> 84 PHP mirror sites should provide the exact content coming from our servers, 85 and must not be altered in any way unless explicitly stated in the mirroring 86 guidelines. Failing to do will result in immediate termination and permanent 87 expulsion of your participation in the program. 88</p> 89 90<h2>Add SQLite 3 Support</h2> 91 92<p> 93 <a href="http://www.sqlite.org">SQLite</a> is an embedded 94 SQL database implementation that has very high performance for applications 95 with low write concurrency. PHP mirrors can currently employ SQLite for URL 96 shortcut lookups. 97</p> 98 99<p> 100 There are a couple of SQLite 3 implementations in PHP. One is via the 101 PDO extension by using the SQLite driver (pdo_sqlite, which is required). 102 The other is via the SQLite3 extension. These extensions are both compiled 103 into PHP by default. Note: Some Linux distributions disable many extensions 104 in their package systems, including SQLite. Please make sure you install the 105 "php5-sqlite" (or similar) package if using such a system. 106</p> 107 108<h2>Setup Apache VirtualHost</h2> 109 110<p> 111 Make sure your web server is set up to serve <code>.php</code> files as PHP 112 parsed files. If it isn't, add the MIME type to your config. 113</p> 114<p class="warn"> 115 Please make sure you have turned off output compression for binary files. 116</p> 117 118<p> 119 Create a VirtualHost entry, which looks something like: 120</p> 121 122<a name="settings"></a> 123<pre class="info"> 124<VirtualHost *-or-your-hostname-or-your-ip-here> 125 <Directory /www/htdocs/phpweb> 126 # Do not display directory listings if index is not present, 127 # and do not try to match filenames if extension is omitted 128 Options -Indexes -MultiViews 129 </Directory> 130 131 ServerName mymirror.example.com 132 ServerAdmin yourname@example.com 133 UseCanonicalName On 134 135 # Webroot of PHP mirror site 136 DocumentRoot /www/htdocs/phpweb 137 138 # Log server activity 139 ErrorLog logs/error_log 140 TransferLog logs/access_log 141 142 # Set directory index 143 DirectoryIndex index.php index.html 144 145 # Handle errors with local error handler script 146 ErrorDocument 401 /error.php 147 ErrorDocument 403 /error.php 148 ErrorDocument 404 /error.php 149 150 # Add types not specified by Apache by default 151 AddType application/octet-stream .chm .bz2 .tgz .msi 152 AddType application/x-pilot .prc .pdb 153 154 # Set mirror's preferred language here 155 SetEnv MIRROR_LANGUAGE "en" 156 157 # The next two lines are only necessary if generating 158 # stats (see below), otherwise you should comment them out 159 Alias /stats/ /path/to/local/stats/ 160 SetEnv MIRROR_STATS 1 161 162 # Apache2 has 'AddHandler type-map var' enabled by default. 163 # Remove the comment sign on the line below if you have it enabled. 164 # RemoveHandler var 165 166 # Turn spelling support off (which would break URL shortcuts) 167 <IfModule mod_speling.c> 168 CheckSpelling Off 169 </IfModule> 170 171 # A few recommended PHP directives 172 php_flag display_errors off 173 174 # If you have Russian Apache with mod_charset installed, 175 # do not forget to search for this line in your existing 176 # configuration, and comment it out: 177 # AddHandler strip-meta-http .htm .html 178 179</VirtualHost> 180</pre> 181 182<p> 183 When setting up the vhost, provide an asterisk, a hostname, or an IP 184 address in the VirtualHost container's header (depending on whether 185 you would like to make the vhost work for all IPs handled by Apache, 186 or just a specific hostname/IP address). Consult 187 <a href="http://httpd.apache.org/docs/vhosts/index.html">the Apache 188 documentation</a> for the differences of the two methods. 189</p> 190 191<p> 192 Change the DocumentRoot setting as appropriate, 193 specify the mirror's preferred language, and provide settings according 194 to your stats setup, if your mirror is going to provide stats. For the 195 preferred language setting, choose one from those available as 196 manual translations. If you provide something else, your default 197 language will be English. After you restart Apache, your mirror 198 site should start working. 199</p> 200 201<h2>Setting Up Local Stats</h2> 202 203<p> 204 Setting up local stats can be a plus on your mirror. We 205 provide <a href="/mirroring-stats.php">some setup 206 instructions for that</a>. 207</p> 208 209<h2>Setup Regular Updates</h2> 210 211<p> 212 You must also set up a cron job that periodically does an rsync to 213 refresh your web directory. We prefer that all mirrors update from 214 the appropriate RRN from the coverage map not more than once an hour, to 215 speed up the distribution of updates to the site and available packages. 216 Something like: 217</p> 218 219<pre class="info"> 220 5 * * * * rsync -avzC --timeout=600 --delete --delete-after --include='distributions/*.exe' YOUR_RRN_HOSTNAME::phpweb /your/local/path 221</pre> 222 223<p> 224 Remember to specify the same rsync parameters you used to get the 225 <code>phpweb</code> files as explained near the top of this page. 226 If you're unable to synchronize every five minutes, you may pick 227 your own update frequency, provided it does not exceed fifteen 228 minutes. 229</p> 230 231<h2>Sponsor Logo</h2> 232 233<p> 234 We would like to thank you for providing a mirror, so 235 if you would like to display a logo on the mirror site promoting your 236 company, you are able to do so by following these steps: 237</p> 238 239<ul> 240 <li>Create a 120 x 60 pixel sized logo button.</li> 241 <li>Copy it to your <code>/www/htdocs/phpweb/backend</code> folder as <code>mirror.gif</code>, <code>mirror.jpg</code> or <code>mirror.png</code>.</li> 242 <li>Go visit your mirror URL (e.g. http://foo.php.net/mirror.php) and check if it is there.</li> 243</ul> 244 245<p> 246 The <a href="/credits.php">PHP Group</a> and the Network Infrastructure Manager reserve the 247 right to refuse images based on content, but most things should be fine. 248</p> 249 250<p> 251 We have chosen a banner size which conforms with the 252 <a href="http://www.iab.net/standards/adunits.asp">Internet 253 Advertising Bureau standards</a>. 254</p> 255 256<p> 257 And finally, don't forget to put a nice little PHP logo somewhere 258 on your hosting company's site if possible. Grab one of the logos 259 from the <a href="/download-logos.php">logos download</a> page, and 260 link it to your mirror. This shows the community that you are a 261 proud supporter of PHP and open source technology. 262</p> 263 264<h2>Mirror Setup Troubleshooting</h2> 265 266<p> 267 The <a href="/mirroring-troubles.php">mirror troubleshooting guide</a> 268 contains information about the common and potential problems discovered 269 when setting up and maintaining a PHP.net mirror. Included are links that 270 perform many of the tests executed by the automated mirror management tools. 271</p> 272 273<p> 274 There is a mailing list named <code>"php-mirrors"</code> at 275 <code>lists.php.net</code>, to which you can subscribe. 276 This mailing list is very low-traffic and only used for communication 277 between mirror maintainers and php.net webmasters. 278</p> 279<p> 280 To subscribe send an empty message 281 to: <a href="mailto:php-mirrors-subscribe@lists.php.net">php-mirrors-subscribe@lists.php.net</a> 282</p> 283 284<p> 285 <em> 286 Thank you for your interest in providing a mirror! If you ever have any 287 questions or concerns, drop us a line at 288 <a href="mailto:php-mirrors@lists.php.net">php-mirrors@lists.php.net</a> 289 --- we are here to help! 290 </em> 291</p> 292 293<?php site_footer(); ?> 294