问题
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.
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.
Here's a PHP file that I use to measure the time.
<?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");?>
回答1:
Change :
extension=apc.so
By :
;extension=apc.so
In :
/etc/php5/apache2/conf.d/apc.ini
And restart Apache server :
apache2ctl graceful
回答2:
You can enter the following command with root permission:
pecl uninstall apc
回答3:
apc.enabled can be set to 0 to disable APC from php.ini Than restart your web server or php-fpm.
回答4:
you can use following script then put it on 1st line of your php file,
apc_clear_cache();
来源:https://stackoverflow.com/questions/11309987/disable-or-remove-apc