dismiss Step into the future! Click here to switch to the beta php.net site
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Existing mirror sites

Properly working mirror sites are listed on our mirrors page.

Mirroring The PHP Website

If you would like to become an official PHP mirror, please be sure to read and follow these instructions carefully. You should have the consent of your hosting company (if you aren't a hosting company yourself), and be prepared for some reasonably significant bandwidth usage. A reasonable estimate as of September 2006 is 2GB/day, which can go up to 12GB/day for busy mirrors, like uk.php.net. The PHP website requires at least PHP 4.3.x, but PHP 5 is preferred. Set it up as an Apache module with the settings outlined below, or in any other Apache connected way (CGI, FastCGI, etc), considering the requested PHP settings outlined below in the Apache vhost instructions. The size of the full website is approximately 1.7 gigabyte.

Please note that we are currently only accepting new official mirrors in countries where we don't already have two active official mirrors. For a list of official mirrors have a look at mirrors.php. Before you start to set up an official mirror site, it is advisable to contact mirrors@php.net, and ask if you have chance to get your mirror site accepted. We have this limit in place to avoid overloading our rsync server and monitoring infrastructure as well as the people who actively assist mirror sites stay up to date and correctly configured. We have found that this 2 mirror limit per country serves our users well, so please do not ask to be the 3rd in a country that already has 2 unless you have a very good reason. Please also ensure that the mirror is located in the country you would like to register the mirror for.

If you are not an official mirror (eg. mirror the site for your company's internal use), you should not rsync from rsync.php.net more frequently than once a day, or you may find your IP blocked. Also, please make an effort to only mirror those parts of the site that you actually need. (For example, exclude the manual in all languages that you will not be using and exclude the distributions directory.)

Get Files With Rsync

First, you need to have a rsync installed. As you have rsync, fetch the web files with the following:

    rsync -avzC --timeout=600 --delete --delete-after \
      --include='distributions/*.exe' \
      rsync.php.net::phpweb /your/local/path 

Setting up an unofficial mirror, and want to only mirror one language of the manual? Add:

    --include='manual/en/' --include='manual/en/**' --exclude='manual/**' --exclude='distributions/manual/**'

after "--delete-after" in the command line above (substituting your prefered language code in place of 'en'). You can also exclude the whole distributions directory (and the related extra folder) by replacing "--exclude='distributions/manual/**'" with "--exclude='distributions/**' --exclude='extra/**'".

If /your/local/path isn't in your web document tree (why isn't it?), then symlink the phpweb/ directory to the correct place on your server.

Official PHP mirror sites should provide the exact content coming from rsync.php.net, and should not be altered in any way not described in the mirroring guidelines. Failing to do so can result in immediate removal of your mirror from our list.

Add SQLite Support

SQLite is an embedded SQL database implementation that has very high performance for applications with low write concurrency. PHP mirrors currently employ SQLite for URL shortcut lookups, and will use it for manual page displays and searching in the future.

The SQLite database engine itself is bundled with PHP, and the extension enabled by default with recent PHP releases so there are no additional requirements for mirrors other than standard PHP installation.
Note: Some Linux distributions disable many extensions in their package systems, including SQLite. Please make sure you install the "php5-sqlite" package if using such package system.

Setup Apache VirtualHost

Make sure your web server is set up to serve up .php files as PHP parsed files. If it isn't, add the mime-type to your config.

Please make sure you have turned off output compression for binary files

Create a virtualhost which looks something like:

<VirtualHost *-or-your-hostname-or-your-ip-here>
     <Directory /www/htdocs/phpweb>
          # Do not display directory listings if index is not present,
          # and do not try to match filenames if extension is omitted
          Options -Indexes -MultiViews
     </Directory>

     ServerName xx.php.net
     ServerAlias the.cname.you.set.up.example.com www.xx.php.net
     ServerAdmin yourname@example.com
     
     # Webroot of PHP mirror site
     DocumentRoot /www/htdocs/phpweb
     
     # Log server activity
     ErrorLog logs/error_log
     TransferLog logs/access_log
     
     # 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"

     # 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>

     # A few recommended PHP directives
     php_flag display_errors off
     
     # If you have Russian Apache with mod_charset installed,
     # do not forget to search for this line in your existing
     # configuration, and comment it out:
     # AddHandler strip-meta-http .htm .html 
         
</VirtualHost>

You should only start to set up an Apache virtualhost for an official mirror, if you have contacted us first, and asked for a possible name for your mirror. The official names for PHP mirrors are in the convention: "xx.php.net", where "xx" is replaced by the 2-letter country code of your mirror's location. If there already is a "xx.php.net", then you will probably get "xx2.php.net".

Before adding new official mirrors to our DNS, we require the maintainers to set up the mirrors with an address we can use as a CNAME in the DNS. This subdomain (the.cname.you.set.up.example.com in the above example) will be checked by mirror admins before the mirror is added. Therefore it is important that the mirror is capable of serving requests for this name and the (www.)xx.php.net address provided by the mirror administrators.

When setting up the vhost, provide an asterisk, a hostname or an IP address in the VirtualHost container's header depending on whether you would like to make the vhost work for all IPs handled by Apache, or just a specific hostname/IP address. Consult the Apache documentation for the differences of the two methods. It is very important to use your xx.php.net address as the ServerName, so URL redirections will keep the requests in the php.net domain, ensuring that the My PHP.net service will work.

Change the DocumentRoot setting as appropriate, specify the mirror's preferred language, and provide settings according to your stats setup, if your mirror is going to provide it. For the preferred language setting, choose one from those available as manual translations. If you provide something else, your default language will be English. After you restart Apache, your mirror site should start working.

Setup Local Stats

Setting up local stats can be a plus on your mirror. We provide some setup instructions for that.

Setup Regular Updates

You must also set up a cron job that periodically does an rsync to refresh your web directory. This will ensure that your web site is up to date. Something like:

   54 * * * * rsync -avzC --timeout=600 --delete --delete-after --include='distributions/*.exe' rsync.php.net::phpweb /your/local/path

Remember to specify the same rsync parameters you used to get the phpweb files. You should try to stagger your times a bit from the example to help spread the load on the rsync.php.net server.

Sponsor Logo

We would like to thank you for providing a mirror, so if you would like to display a logo on the mirror site promoting your company, you are able to do so by following these steps:

The PHP Group do reserve the right to refuse images based on content, but most things should be fine.

We have chosen a banner size which conforms with the Internet Advertising Bureau standards.

And finally, don't forget to put a nice little PHP logo somewhere on your hosting company's site if possible. Grab one of the logos from the Download logos page, and link it to your mirror.

Mirror Setup Troubleshooting

The mirror troubleshooting guide contains information about the common and potential problems discovered when setting up and maintaining a PHP.net mirror. Included are links that perform many of the tests executed by the automated mirror management tools.

Data Registered About Official Mirrors

Once you have done the above and your site appears to work, send a message to mirrors@php.net with the following information, and appropriate steps will be taken to integrate your mirror site:

There is a mailing list named "php-mirrors" at lists.php.net which we would appreciate if you could sign up to. This mailing list is extremly low traffic and only used for communication between mirror maintainers and the php.net webmasters.

To subscribe send an empty message to: php-mirrors-subscribe@lists.php.net

Thank you for providing a mirror!

 
show source | credits | sitemap | contact | advertising | mirror sites