<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>WinCache Functions Reroutes</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="wincache.sessionhandler.html">WinCache Session Handler</a></div> <div class="next" style="text-align: right; float: right;"><a href="wincache.resources.html">Resource Types</a></div> <div class="up"><a href="wincache.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="wincache.reroutes" class="section"> <h2 class="title">WinCache Functions Reroutes</h2> <p class="para"> The WinCache functions reroutes (available since WinCache 1.2.0) can be used to replace built-in PHP functions with their equivalents that are optimized for a particular purpose. WinCache extension includes Windows-optimized implementation of PHP file functions that may improve performance of PHP applications in cases when PHP has to access files on network shares. The optimized implementation is provided for the following functions: </p> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <a href="function.file-exists.html" class="link">file_exists</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.file-get-contents.html" class="link">file_get_contents</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.readfile.html" class="link">readfile</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.is-readable.html" class="link">is_readable</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.is-writable.html" class="link">is_writable</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.is-dir.html" class="link">is_dir</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.realpath.html" class="link">realpath</a> </span> </li> <li class="listitem"> <span class="simpara"> <a href="function.filesize.html" class="link">filesize</a> </span> </li> </ul> <p class="para"> To configure WinCache to use the functions reroutes use the file <var class="filename">reroute.ini</var> that is included in WinCache installation package. Copy this file into the same directory where <var class="filename">php.ini</var> file is located. After that add the wincache.rerouteini setting in <var class="filename">php.ini</var> and specify an absolute or relative path to the <var class="filename">reroute.ini</var> file. <div class="example" id="example-557"> <p><strong>Example #1 Enabling WinCache functions reroutes</strong></p> <div class="example-contents"> <div class="php.inicode"><pre class="php.inicode">wincache.rerouteini = C:\PHP\reroute.ini</pre> </div> </div> </div> </p> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> If WinCache functions reroutes are enabled it is recommended to increase the WinCache file cache size. This can be done by using <a href="wincache.configuration.html#ini.wincache.fcachesize" class="link">wincache.fcachesize</a> setting. </span> </p></blockquote> <p class="para"> The <var class="filename">reroute.ini</var> file contains the mappings between the native PHP functions and their equivalents in WinCache. Each line in the file defines a mapping by using the following syntax: </p> <p class="simpara"> <em><PHP function name>:[<number of function parameters>]=<wincache function name></em> </p> <p class="para"> The example of the file is shown below. In this example the calls to PHP function <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span> will be replaced with calls to <span class="function"><strong>wincache_file_get_contents()</strong></span> only if the number of parameters passed to the function is less than or equals to 2. Specifying the number of parameters is useful when replacement function does not handle all the function's parameters. <div class="example" id="example-558"> <p><strong>Example #2 Reroute.ini file content</strong></p> <div class="example-contents"> <div class="php.inicode"><pre class="php.inicode">[FunctionRerouteList] file_exists=wincache_file_exists file_get_contents:2=wincache_file_get_contents readfile:2=wincache_readfile is_readable=wincache_is_readable is_writable=wincache_is_writable is_writeable=wincache_is_writable is_file=wincache_is_file is_dir=wincache_is_dir realpath=wincache_realpath filesize=wincache_filesize</pre> </div> </div> </div> </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="wincache.sessionhandler.html">WinCache Session Handler</a></div> <div class="next" style="text-align: right; float: right;"><a href="wincache.resources.html">Resource Types</a></div> <div class="up"><a href="wincache.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>