Disable or remove apc

好久不见. 提交于 2019-12-09 13:35:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!