Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to check if APC is installed and working?

Tags:

php

apc

I'm writing a wordpress plugin where the CSS is compiled dinamically and thus i've implemented various strategies to cache it. As of now the first choice for caching is APC if it's installed.

This is how i'm checking it

    $is_apc_installed = function_exists('apc_store')
        && function_exists('apc_fetch') && ini_get('apc.enabled');
    $sapi_type = php_sapi_name();
    if (substr($sapi_type, 0, 3) === 'cgi') {
        $is_apc_installed = false;
    }
            

but on some installs i still get that apc_fetch() always return false. What else should i check to be sure that APC is working correctly?

like image 232
Nicola Peluchetti Avatar asked Oct 26 '12 13:10

Nicola Peluchetti


People also ask

How do I install an APCu file on Windows?

Step 1: We will download require a version of APCu file from here. This page will have a table with all available releases. Step 2: Let's copy the above dll file and paste it into c:/wamp/bin/php/ext/ folder. Step 3: We will restart the wamp or machine.


1 Answers

You can try the extension_loaded function

$is_apc_installed = extension_loaded('apc');
like image 148
Nikolaos Dimopoulos Avatar answered Sep 30 '22 17:09

Nikolaos Dimopoulos