diff --git a/reference/wincache/book.xml b/reference/wincache/book.xml new file mode 100644 index 0000000000..ea8c93b60c --- /dev/null +++ b/reference/wincache/book.xml @@ -0,0 +1,85 @@ + + + + + + Windows Cache for PHP + WinCache + + + &reftitle.intro; + + Windows Cache Extension for PHP is a PHP accelerator that is used to increase the speed of + PHP applications running on Windows and Windows Server. Once the Windows Cache Extension for + PHP is enabled and loaded by the PHP engine, PHP applications can take advantage of the + functionality without any code modifications. + + + The Windows Cache Extension includes 3 different types of caches. The following describes + the purpose of each cache type and the benefits it provides. + + + + + PHP Opcode Cache - PHP is a script processing engine, which reads + an input stream of data that contains text and/or PHP instructions and produces another + stream of data, most commonly in the HTML format. This means that on a web server the + PHP engine reads, parses, compiles and executes a PHP script each time that it is requested + by a Web client. The reading, parsing and compilation operations put additional load on the + web server's CPU and file system and thus affect the overall performance of a PHP web application. + The PHP bytecode (opcode) cache is used to store the compiled script bytecode in shared memory so + that it can be re-used by PHP engine for subsequent executions of the same script. + + + + + File Cache - Even with the PHP bytecode cache enabled, the PHP engine + has to accesses the script files on a file system. When PHP scripts are stored on a remote + UNC file share, the file operations introduce a significant performance overhead. + The Windows Cache Extension for PHP includes a file cache that is used to store the content + of the PHP script files in shared memory, which reduces the amount of file system operations + performed by PHP engine. + + + + + Relative File Path Cache - PHP scripts very often include or operate + with files by using relative file paths. Every relative file path has to be converted to + an absolute file path by the PHP engine. When a PHP application uses many PHP files and + accesses them by relative paths, the operation of resolving relative paths to absolute paths + may negatively impact the application's performance. The Windows Cache Extension for PHP + provides a Relative File Path cache, which is used to store the mappings between relative + and absolute file paths, thereby reducing the number of relative path resolutions that the + PHP engine has to perform. + + + + + + &reference.wincache.setup; + &reference.wincache.constants; + &reference.wincache.reference; + + + + + diff --git a/reference/wincache/constants.xml b/reference/wincache/constants.xml new file mode 100644 index 0000000000..cab7f8a0dc --- /dev/null +++ b/reference/wincache/constants.xml @@ -0,0 +1,29 @@ + + + + + &reftitle.constants; + &no.constants; + + + + diff --git a/reference/wincache/functions/wincache-fcache-fileinfo.xml b/reference/wincache/functions/wincache-fcache-fileinfo.xml new file mode 100644 index 0000000000..d63468d879 --- /dev/null +++ b/reference/wincache/functions/wincache-fcache-fileinfo.xml @@ -0,0 +1,165 @@ + + + + + wincache_fcache_fileinfo + + Retrieves information about files cached in the file cache + + + + &reftitle.description; + + arraywincache_fcache_fileinfo + + + + Retrieves information about file cache content and its usage. + + + + &reftitle.returnvalues; + + Array of meta data about file cache &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + total_cache_uptime - total time in seconds that the file cache has been active + + + + + total_file_count - total number of files that are currently in the file cache + + + + + total_hit_count - number of times the files have been served from the file cache + + + + + total_miss_count - number of times the files have note been found in the file cache + + + + + file_entries - an array that contains the information about all the cached files: + + + + file_name - absolute file name of the cached file + + + + + add_time - time in seconds since the file has been added to the file cache + + + + + use_time - time in seconds since the file has been accessed in the file cache + + + + + last_check - time in seconds since the file has been checked for modifications + + + + + hit_count - number of times the file has been served from the cache + + + + + file_size - size of the cached file in bytes + + + + + + + + + + &reftitle.examples; + + + A <function>wincache_fcache_fileinfo</function> example + + + + + +]]> + + &example.outputs; + + 3234 + [total_file_count] => 5 + [total_hit_count] => 0 + [total_miss_count] => 1 + [file_entries] => Array + ( + [1] => Array + ( + [file_name] => c:\inetpub\wwwroot\checkcache.php + [add_time] => 1 + [use_time] => 0 + [last_check] => 1 + [hit_count] => 1 + [file_size] => 2435 + ) + [2] => Array (...iterates for each cached file) + ) +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_meminfo + wincache_ocache_fileinfo + wincache_ocache_meminfo + wincache_rplist_fileinfo + wincache_rplist_meminfo + + + + + + + diff --git a/reference/wincache/functions/wincache-fcache-meminfo.xml b/reference/wincache/functions/wincache-fcache-meminfo.xml new file mode 100644 index 0000000000..f6d5c5b690 --- /dev/null +++ b/reference/wincache/functions/wincache-fcache-meminfo.xml @@ -0,0 +1,123 @@ + + + + + wincache_fcache_meminfo + + Retrieves information about file cache memory usage + + + + &reftitle.description; + + arraywincache_fcache_meminfo + + + + Retrieves information about memory usage by file cache. + + + + &reftitle.returnvalues; + + Array of meta data about file cache memory usage &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + memory_total - amount of memory in bytes allocated for the file cache + + + + + memory_free - amount of free memory in bytes available for the file cache + + + + + num_used_blks - number of memory blocks used by the file cache + + + + + num_free_blks - number of free memory blocks available for the file cache + + + + + memory_overhead - amount of memory in bytes used for the file cache internal structures + + + + + + + + &reftitle.examples; + + + A <function>wincache_fcache_meminfo</function> example + + + + + +]]> + + &example.outputs; + + 134217728 + [memory_free] => 131339120 + [num_used_blks] => 361 + [num_free_blks] => 3 + [memory_overhead] => 5856 +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_fileinfo + wincache_ocache_fileinfo + wincache_ocache_meminfo + wincache_rplist_fileinfo + wincache_rplist_meminfo + + + + + + + \ No newline at end of file diff --git a/reference/wincache/functions/wincache-ocache-fileinfo.xml b/reference/wincache/functions/wincache-ocache-fileinfo.xml new file mode 100644 index 0000000000..aab5d3276e --- /dev/null +++ b/reference/wincache/functions/wincache-ocache-fileinfo.xml @@ -0,0 +1,172 @@ + + + + + wincache_ocache_fileinfo + + Retrieves information about files cached in the opcode cache + + + + &reftitle.description; + + arraywincache_ocache_fileinfo + + + + Retrieves information about opcode cache content and its usage. + + + + &reftitle.returnvalues; + + Array of meta data about opcode cache &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + total_cache_uptime - total time in seconds that the opcode cache has been active + + + + + total_file_count - total number of files that are currently in the opcode cache + + + + + total_hit_count - number of times the compiled opcode have been served from the cache + + + + + total_miss_count - number of times the compiled opcode have note been found in the cache + + + + + file_entries - an array that contains the information about all the cached files: + + + + file_name - absolute file name of the cached file + + + + + add_time - time in seconds since the file has been added to the opcode cache + + + + + use_time - time in seconds since the file has been accessed in the opcode cache + + + + + last_check - time in seconds since the file has been checked for modifications + + + + + hit_count - number of times the file has been served from the cache + + + + + function_count - number of functions in the cached file + + + + + class_count - number of classes in the cached file + + + + + + + + + + &reftitle.examples; + + + A <function>wincache_ocache_fileinfo</function> example + + + + + +]]> + + &example.outputs; + + 17357 + [total_file_count] => 121 + [total_hit_count] => 36562 + [total_miss_count] => 201 + [file_entries] => Array + ( + [1] => Array + ( + [file_name] => c:\inetpub\wwwroot\checkcache.php + [add_time] => 17356 + [use_time] => 7 + [last_check] => 10 + [hit_count] => 454 + [function_count] => 0 + [class_count] => 1 + ) + [2] => Array (...iterates for each cached file) + ) +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_fileinfo + wincache_fcache_meminfo + wincache_ocache_meminfo + wincache_rplist_fileinfo + wincache_rplist_meminfo + + + + + + + diff --git a/reference/wincache/functions/wincache-ocache-meminfo.xml b/reference/wincache/functions/wincache-ocache-meminfo.xml new file mode 100644 index 0000000000..b963ff595a --- /dev/null +++ b/reference/wincache/functions/wincache-ocache-meminfo.xml @@ -0,0 +1,123 @@ + + + + + wincache_ocache_meminfo + + Retrieves information about opcode cache memory usage + + + + &reftitle.description; + + arraywincache_ocache_meminfo + + + + Retrieves information about memory usage by opcode cache. + + + + &reftitle.returnvalues; + + Array of meta data about opcode cache memory usage &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + memory_total - amount of memory in bytes allocated for the opcode cache + + + + + memory_free - amount of free memory in bytes available for the opcode cache + + + + + num_used_blks - number of memory blocks used by the opcode cache + + + + + num_free_blks - number of free memory blocks available for the opcode cache + + + + + memory_overhead - amount of memory in bytes used for the opcode cache internal structures + + + + + + + + &reftitle.examples; + + + A <function>wincache_ocache_meminfo</function> example + + + + + +]]> + + &example.outputs; + + 134217728 + [memory_free] => 112106972 + [num_used_blks] => 15469 + [num_free_blks] => 4 + [memory_overhead] => 247600 +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_fileinfo + wincache_fcache_fileinfo + wincache_ocache_fileinfo + wincache_rplist_fileinfo + wincache_rplist_meminfo + + + + + + + \ No newline at end of file diff --git a/reference/wincache/functions/wincache-refresh-if-changed.xml b/reference/wincache/functions/wincache-refresh-if-changed.xml new file mode 100644 index 0000000000..669cdd91eb --- /dev/null +++ b/reference/wincache/functions/wincache-refresh-if-changed.xml @@ -0,0 +1,95 @@ + + + + + wincache_refresh_if_changed + + Refreshes the cache entries for the cached files + + + + &reftitle.description; + + boolwincache_refresh_if_changed + arrayfiles + + + Refreshes the cache entries for the files, whose names were passed in the input argument. + If no argument is specified then refreshes all the entries in the cache. + + + + &reftitle.parameters; + + + + files + + + An array of file names for files that need to be refreshed. + An absolute or relative file paths can be used. + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.examples; + + WinCache performs regular checks on the cached files to + ensure that if any file has changed then the corresponding entry in the cache is + updated. By default this check is performed every 30 seconds. If, for example, + a PHP script updates another PHP script where the application's + configuration settings are stored, then it may happen that after the + configuration settings have been saved to a file, the application is still using + old settings for some time until the cache is refreshed. In those cases it may be + preferrable to refresh the cache right after the file has been changed. The + following example shows how this can be done. + + A <function>wincache_refresh_if_changed</function> example + +'); +fclose($handle); +wincache_refresh_if_changed(array($filename)); +?> +]]> + + + + + + + + diff --git a/reference/wincache/functions/wincache-rplist-fileinfo.xml b/reference/wincache/functions/wincache-rplist-fileinfo.xml new file mode 100644 index 0000000000..18176a6d4e --- /dev/null +++ b/reference/wincache/functions/wincache-rplist-fileinfo.xml @@ -0,0 +1,128 @@ + + + + + wincache_rplist_fileinfo + + Retrieves information about relative file path cache + + + + &reftitle.description; + + arraywincache_rplist_fileinfo + + + + Retrieves information about cached mappings between relative file paths + and corresponding absolute file paths. + + + + &reftitle.returnvalues; + + Array of meta data about the relative file path cache &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + total_file_count - total number of relative file path + mappings stored in the cache + + + + + rplist_entries - an array that contains the information about all + the cached relative file paths: + + + + relative_path - relative path to a file + + + + + subkey_data - corresponding absolute path to a file + + + + + + + + + + &reftitle.examples; + + + A <function>wincache_rplist_fileinfo</function> example + + + + + +]]> + + &example.outputs; + + 5 + [rplist_entries] => Array + ( + [1] => Array + ( + [relative_path] => checkcache.php + [subkey_data] => c:\inetpub\wwwroot|c:\inetpub\wwwroot\checkcache.php + ) + + [2] => Array (...iterates for each cached file) + ) +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_meminfo + wincache_fcache_fileinfo + wincache_ocache_fileinfo + wincache_ocache_meminfo + wincache_rplist_meminfo + + + + + + + diff --git a/reference/wincache/functions/wincache-rplist-meminfo.xml b/reference/wincache/functions/wincache-rplist-meminfo.xml new file mode 100644 index 0000000000..6f63821058 --- /dev/null +++ b/reference/wincache/functions/wincache-rplist-meminfo.xml @@ -0,0 +1,123 @@ + + + + + wincache_rplist_meminfo + + Retrieves information about memory usage by the relative file path cache + + + + &reftitle.description; + + arraywincache_rplist_meminfo + + + + Retrieves information about memory usage by relative file path cache. + + + + &reftitle.returnvalues; + + Array of meta data that describes memory usage by relative file path cache. &return.falseforfailure; + + + The array returned by this function contains the following elements: + + + + memory_total - amount of memory in bytes allocated for the relative file path cache + + + + + memory_free - amount of free memory in bytes available for the relative file path cache + + + + + num_used_blks - number of memory blocks used by the relative file path cache + + + + + num_free_blks - number of free memory blocks available for the relative file path cache + + + + + memory_overhead - amount of memory in bytes used for the internal structures of relative file path cache + + + + + + + + &reftitle.examples; + + + A <function>wincache_rplist_meminfo</function> example + + + + + +]]> + + &example.outputs; + + 9437184 + [memory_free] => 9416744 + [num_used_blks] => 23 + [num_free_blks] => 1 + [memory_overhead] => 416 +) +]]> + + + + + + + &reftitle.seealso; + + + wincache_fcache_fileinfo + wincache_fcache_fileinfo + wincache_ocache_fileinfo + wincache_ocache_meminfo + wincache_rplist_fileinfo + + + + + + + \ No newline at end of file diff --git a/reference/wincache/ini.xml b/reference/wincache/ini.xml new file mode 100644 index 0000000000..48d8966a56 --- /dev/null +++ b/reference/wincache/ini.xml @@ -0,0 +1,340 @@ + + +
+ &reftitle.runtime; + &extension.runtime; + + The following table lists and explains the configuration settings + provided by the WinCache extension: + + + + WinCache configuration options + + + + Name + Default + Minimum + Maximum + Changeable + Changelog + + + + + wincache.fcenabled + "1" + "0" + "1" + PHP_INI_ALL + Available since WinCache 1.0.0 + + + wincache.fcenabledfilter + "NULL" + "NULL" + "NULL" + PHP_INI_ALL + Available since WinCache 1.0.0 + + + wincache.fcachesize + "24" + "8" + "128" + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.maxfilesize + "256" + "10" + "2048" + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.ocenabled + "1" + "0" + "1" + PHP_INI_ALL + Available since WinCache 1.0.0 + + + wincache.ocenabledfilter + "NULL" + "NULL" + "NULL" + PHP_INI_ALL + Available since WinCache 1.0.0 + + + wincache.ocachesize + "96" + "16" + "256" + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.filecount + "4096" + "1024" + "16384" + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.chkinterval + "30" + "0" + "300" + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.ttlmax + "1200" + "0" + "7200" + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.enablecli + 0 + 0 + 1 + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.ignorelist + NULL + NULL + NULL + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + wincache.namesalt + NULL + NULL + NULL + PHP_INI_SYSTEM + Available since WinCache 1.0.0 + + + +
+ &ini.php.constants; +
+ + &ini.descriptions.title; + + + + + + wincache.fcenabled + boolean + + + Enables or disables the file cache functionality. + + + + + wincache.fcenabledfilter + string + + + + Defines a comma-separated list of IIS web site identifiers where file + cache should be enabled or disabled. This setting works in conjunction + with wincache.fcenabled: if wincache.fcenabled + is set to 1, then the sites listed in the wincache.fcenabledfilter + will have the file cache turned off; if wincache.fcenabled + is set to 0, then the sites listed in the wincache.fcenabledfilter + will have the file cache turned on. + + + + + + wincache.fcachesize + integer + + + + Defines the maximum memory size (in megabytes) that is allocated for the file cache. + If the total size of all the cached files exceeds the value specified in this setting, + then most stale files will be removed from the file cache. + + + + + + wincache.maxfilesize + integer + + + + Defines the maximum allowed size (in kilobytes) for a single file to be cached. + If a file size exceeds the specified value, the file will not be cached. + This setting applies to the file cache only. + + + + + + wincache.ocenabled + boolean + + + Enables or disables the opcode cache functionality + + + + + wincache.ocenabledfilter + string + + + + Defines a comma-separated list of IIS web site identifiers where opcode + cache should be enabled or disabled. This setting works in conjunction + with wincache.ocenabled: if wincache.ocenabled + is set to 1, then the sites listed in the wincache.ocenabledfilter + will have the opcode cache turned off; if wincache.ocenabled + is set to 0, then the sites listed in the wincache.ocenabledfilter + will have the opcode cache turned on. + + + + + + wincache.ocachesize + integer + + + + Defines the maximum memory size (in megabytes) that is allocated for the + opcode cache. If the cached opcode size exceeds the specified value, + then most stale opcode will be removed from the cache. + + + + + + wincache.filecount + integer + + + + Defines how many files are expected to be cached by the extension, so that appropriate + memory size is allocated at the startup time. If the number of files exceeds the specified + value, the WinCache will re-allocate more memory as needed. + + + + + + wincache.chkinterval + integer + + + + Defines how often (in seconds) the extension checks for file changes in order + to refresh the cache. Setting it to 0 will disable the refreshing of the cache. + The file changes will not be reflected in the cache unless the cache entry for + that file is removed by scavenger or IIS application pool is recycled or + wincache_refresh_if_changed function is called. + + + + + + wincache.ttlmax + integer + + + + Defines the maximum time to live (in seconds) for a cached entry without being used. + Setting it to 0 will disable the cache scavenger, so the cached entries will never + be removed from the cache during the lifetime of the IIS worker process. + + + + + + wincache.enablecli + boolean + + + + Defines if caching is enabled when PHP is running in command line (CLI) mode. + + + + + + wincache.ignorelist + string + + + + Defines a list of files that should not be cached by the extension. + The files list is specified by using file names only, separated by + the pipe symbol - "|". + + <literal>wincache.ignorelist</literal> example + + + + + + + + + + wincache.namesalt + boolean + + + + Defines a string that will be used when naming the extension + specific objects that are stored in shared memory. This is used + to avoid conflicts that may be caused if other applications within + an IIS worker process tries to access shared memory. + + + + + +
+ + diff --git a/reference/wincache/reference.xml b/reference/wincache/reference.xml new file mode 100644 index 0000000000..c191abe15b --- /dev/null +++ b/reference/wincache/reference.xml @@ -0,0 +1,31 @@ + + + + + WinCache &Functions; + + &reference.wincache.entities.functions; + + + + + diff --git a/reference/wincache/setup.xml b/reference/wincache/setup.xml new file mode 100644 index 0000000000..42a088ee37 --- /dev/null +++ b/reference/wincache/setup.xml @@ -0,0 +1,143 @@ + + + + + &reftitle.setup; + +
+ &reftitle.required; + + The extension is currently supported only on the following configurations: + + Windows OS: + + + Windows XP SP3 with IIS 5.1 and FastCGI Extension + + + Windows Server 2003 with IIS 6.0 and FastCGI Extension + + + Windows Vista SP1 with IIS 7.0 and FastCGI Module + + + Windows Server 2008 with IIS 7.0 and FastCGI Module + + + PHP: + + + PHP 5.2.X, Non-thread-safe build + + + PHP 5.3 X86, Non-thread-safe VC9 build + + + + + The WinCache Extension can only be used when IIS is configured to run PHP via FastCGI. + + +
+
+ &reftitle.install; + + &pecl.moved; + + + &pecl.info; + &url.pecl.package;wincache. + + + There are two packages for this extension: one package is for PHP versions 5.2.X, + and the other package is for PHP 5.3.X. Select the package that is appropriate for + the PHP version being used. + + + To install and enable the extension, follow these steps: + + + + + Unpack the package into some temporary location. + + + + + Copy the php_wincache.dll file into the PHP extensions folder. + Typically this folder is called "ext" and it is located in the same folder with all + PHP binary files. For example: C:\Program Files\PHP\ext. + + + + + Using a text editor, open the php.ini file, which is usually located in the + same folder where all PHP binary files are. For example: + C:\Program Files\PHP\php.ini. + + + + + Add the following line at the end of the php.ini file: + extension = php_wincache.dll. + + + + + Save and close the php.ini file. + + + + + Recycle the IIS Application Pools for PHP to pick up the configuration changes. + To check that the extension has been enabled, create a file called + phpinfo.php with a PHP code that calls + phpinfo function. + + + + + Save the phpinfo.php file in the root folder of a + IIS web site that uses PHP, then open a browser and make a request to + http://localhost/phpinfo.php. Search within the returned web page + for a section called wincache. If the extension + is enabled, then the phpinfo + output will list the configuration settings provided by the WinCache. + + + + + + Do not forget to remove phpinfo.php file from the web site's root folder after verifying that extension has been enabled. + + +
+ &reference.wincache.ini; + +
+ &reftitle.resources; + &no.resource; +
+
+ + + diff --git a/reference/wincache/versions.xml b/reference/wincache/versions.xml new file mode 100644 index 0000000000..7e86824ad3 --- /dev/null +++ b/reference/wincache/versions.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + \ No newline at end of file