PHP8 WinCache Statistics Script

2023-10-09 15:51 更新

WinCache的安装包包括一个名为wincache.php的PHP脚本,可用于获取缓存信息和统计信息。

如果通过Microsoft Web Platform Installer安装了WinCache扩展,那么该脚本位于%SystemDrive%\Program Files\IIS\Windows Cache for PHP\目录下。在64位版本的Windows Server操作系统上,该脚本位于%SystemDrive%\Program Files (x86)\IIS\Windows Cache for PHP\目录下。如果扩展是手动安装的,则wincache.php将位于从安装包的内容中提取的相同文件夹中。

要使用wincache.php,请将其复制到Web站点的根文件夹或任何子文件夹中。为了保护脚本的安全性,使用文本编辑器打开它,并替换USERNAME和PASSWORD常量的值。如果服务器上启用了任何其他IIS身份验证,请按照注释中的说明进行操作。

示例 #1 Authentication configuration for wincache.php

<?php
/**
* ======================== CONFIGURATION SETTINGS ==============================
* If you do not want to use authentication for this page, set USE_AUTHENTICATION to 0.
* If you use authentication then replace the default password.
*/
define('USE_AUTHENTICATION', 1);
define('USERNAME', 'wincache');
define('PASSWORD', 'wincache');

/**
* The Basic PHP authentication will work only when IIS is configured to support
* Anonymous Authentication' and nothing else. If IIS is configured to support/use
* any other kind of authentication like Basic/Negotiate/Digest etc, this will not work.
* In that case use the array below to define the names of users in your
* domain/network/workgroup which you want to grant access to.
*/
$user_allowed = array('DOMAIN\user1', 'DOMAIN\user2', 'DOMAIN\user3');

/**
* If the array contains string 'all', then all the users authenticated by IIS
* will have access to the page. Uncomment the below line and comment above line
* to grant access to all users who gets authenticated by IIS.
*/
/* $user_allowed = array('all'); */

/** ===================== END OF CONFIGURATION SETTINGS ========================== */
?>

注意: 始终使用内置身份验证或服务器的身份验证机制来保护wincache.php脚本。不保护此脚本可能会危及您的Web应用程序和Web服务器的安全性。


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号