php 禁用或删除 apc
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11309987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Disable or remove apc
提问by Dragos C.
I installed APC on my ubuntu 11.04 linux and I want to make some performance benchmarks to see what's the speed improvement over PHP without APC but I don't know how to disable/remove the APC.
我在我的 ubuntu 11.04 linux 上安装了 APC,我想进行一些性能基准测试,看看在没有 APC 的情况下 PHP 的速度有什么改进,但我不知道如何禁用/删除 APC。
I tried to empty my apc.ini files but it didn't worked. Still after I load a page for the first time, the page will be stored in the cached and the second time I load the page, it loads much faster.
我试图清空我的 apc.ini 文件,但没有奏效。第一次加载页面后,页面将存储在缓存中,第二次加载页面时,加载速度要快得多。
Here's a PHP file that I use to measure the time.
这是我用来测量时间的 PHP 文件。
<?php
function getTime()
{
$a = explode (' ',microtime());
return(double) $a[0] + $a[1];
}
$Start = getTime();
?>
<?php require_once("includes/connection.php");?>
<?php require_once("includes/functions.php");?>
<?php
find_selected_page(true);
?>
<?php require_once("includes/header.php");?>
<table id="structure">
<tr>
<td id="navigation">
<?php echo navigation_public($sel_subject,true);
// $sel_page is sent as a GLOBAL so that we can reuse is in the page area
?>
</td>
<td id="page">
<?php
if($sel_page!=NULL)
{
echo "<h2>".htmlentities($sel_page['menu_name'])."</h2>";
echo "<p>".strip_tags(nl2br($sel_page['content']),"<b><br><p><a>")."</p>";
}
else if($sel_subject!=NULL)
{
echo "<h2>".$sel_subject['menu_name']."</h2>";
}
else
{
echo "<h2>Welcome to Widget Corp</h2>";
}
?>
</td>
</tr>
</table>
<?php
$End = getTime();
echo "Time taken = ".number_format(($End - $Start),3)." secs";
?>
<?php require("includes/footer.php");?>
回答by fsenart
Change :
改变 :
extension=apc.so
By :
经过 :
;extension=apc.so
In :
在 :
/etc/php5/apache2/conf.d/apc.ini
And restart Apache server :
并重新启动 Apache 服务器:
apache2ctl graceful
回答by Cheetah
You can enter the following command with root permission:
您可以在具有 root 权限的情况下输入以下命令:
pecl uninstall apc
回答by osm
apc.enabled can be set to 0 to disable APC from php.ini Than restart your web server or php-fpm.
apc.enabled 可以设置为 0 以从 php.ini 禁用 APC,然后重新启动 Web 服务器或 php-fpm。
回答by Ansyori
you can use following script then put it on 1st line of your php file,
您可以使用以下脚本,然后将其放在 php 文件的第一行,
apc_clear_cache();

