Category Archives: apc

how to remove cache from admin panel using .htaccess

i have a single .htaccess file for both admin panel and website. In my website I am using apc cache for cache and it works fine in website, but in backend/admin panel there are lots of issues due to cache.

now i don't need a cache in admin panal but website i need a cache

So, please tell me how I can write a regex in .htaccess for both website as well as admin panel.

Currently I am using this code in my .htaccess

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/svg+xml "access 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"

For example :

cache works on :
cache not works on :

APC for multiple websites

I'am using APC for caching. I have two website on my server, and I want to use APC seperate for these sites.

So has it's own cache And has it's own cache too

Is it possible with APC?

With default config, when I go to I see the same data as on

I use PHP, Apache, Kohana

php-apcu (CGI/FastCGI) apc_fetch always return false

When using the php-apcu ( extension (not apc) in a php CGI environment the stored data fromapc_store are empty.

Anyone has experiences on how to solve this issue?

Example PHP File: test-apc.php

$k = 'test';
if(isset($_GET['get'])) {
    $result = apc_fetch($k);
    echo "Read entry '$k': $result";
} else if(isset($_GET['clear'])) {
    echo "Clear entry '$k'";
} else {
    apc_store($k, "HelloWord");
    echo "Write entry '$k' set";

Steps to reproduce:

  1. Open http://server/test-apc.php to call apc_store
  2. Open http://server/test-apc.php?get to receive stored data using apc_fetch

BTW: apc_cache_info('user') shows it properly with first request, second is empty

Relevant packages (OS: Debian 3.2.63):

  • Apache 2.2.22 (mpm-prefork, suexec-custom, wrapper)
  • php5.5 as CGI
  • php5-apcu 4.0.7
  • (and dependencies)

xampp apache apc not working in symfony2

I have prollem of high TTFB (time to first byte). I have to install APC or xcache, both of which are not getting started on my apache webserver.

Please advise how to install the APC or xcache. opcache is installed, but I do not know how to use in Symfony2.

[email protected] /c/xampp/htdocs/ims
$ php -v
C:\xampp\php\ext\php_apc.dll doesn't appear to be a valid Zend extension
PHP 5.6.11 (cli) (built: Jul  9 2015 20:55:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

In the php.ini I have,
zend_extension = "C:\xampp\php\ext\php_apc.dll"
;specifies the size for each shared memory segment 8MB to start
;max amount of memory a script can occupy
; means we are always atomically editing the files

In my app/config/config_prod.yml

I want to do both framework:

        cache: validator.mapping.cache.apc
        cache: serializer.mapping.cache.apc

#    orm:
#        metadata_cache_driver: apc
#        result_cache_driver: apc
#        query_cache_driver: apc

I have commented doctrine for now. Will deal with it later.

In, app.php: I want to do the following

$apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);

hard links between php files in different directories, what should be the expected behaviour of __FILE__

I have two websites that are identical in structure. The index.php file needs to generate different content depending on the domain that the page is being served from. I am using apache 2.2 and created two virtual hosts using two different folders under /var/www (/var/www/ and /var/www/

I am using FILE to obtain the full path of the executing index.php and depending on the path I output the correct content.

Since the files are all the same, I wanted to use links to make editing the file easier, so instead of editing one of the index.php, then copying it to the other directory, I wanted editing either of files to update the other.

I used the cp -al command to copy with hard links:

cp -al /var/www/ /var/www/

The problem is that when I access the index.php file in one site vs. the other, the FILE variable does not reflect the path of which index.php file is executing. Depending on which domain I visit first, the FILE will reflect the path of that domain.

I will try using getcwd to see if that works, but can someone explain why this is happening. Shouldn't FILE reflect the current script that's executing.

These are hard links, not soft links.

Is apache caching the script, is APC the source of the problem?

Update: getcwd() worked, it seems to always return the correct current directory.

APC OpCode not working with PHP-FPM

I'm trying to get APC OpCode Cache working along with:

PHP 5.4.30, APC 3.1.15-dev, and PHP-FPM PHP 5.4.30 (fpm-fcgi)

However my "System Cache Entries" on my apc_stats.php is ALWAYS EMPTY

I have the following configuration:

* On /etc/httpd/conf.d/fastcgi.conf

User apache
Group apache
LoadModule fastcgi_module modules/
FastCgiWrapper Off

<IfModule mod_fastcgi.c>
        DirectoryIndex index.html index.shtml index.cgi index.php

        AddHandler php5-fcgi .php
        Action php5-fcgi /php5-fcgi
        Alias /php5-fcgi /php-fpm/php5-fcgi
        FastCgiExternalServer /php-fpm/php5-fcgi -host -pass-header Authorization -idle-timeout 3600


* On /etc/php-fpm.d/www.conf

listen =
pm = dynamic
pm.start_servers = 10

* On /etc/php.d/apc.ini


Please Help! I have tried everything I have think of... =(

.htaccess :: Cannot set a upload_tmp_dir

Looks like a very simple task but it's not working... I'm trying to set upload_tmp_dir to the ROOT directory on my .htaccess file...

php_value upload_tmp_dir /

I'm printing out the results and it's stays the same as the default on my php.ini

echo 'Your Temp Upload Directory : '.ini_get('upload_tmp_dir').'<br>';

IOW... not working.

I know that it's impossible to set it via :


What am I doing wrong here ?