1

Can you recommend how to set up APC for a site running Drupal 7 on apache2 with fastcgi ?

I got to the point where apc.php shows only one file cached that is apc.php itself. I cannot see if APC cache is used at all when accessing Drupal nodes.

PHPinfo shows:

Server API  CGI/FastCGI

apc

APC Support enabled
Version 3.1.9
APC Debugging   Disabled
MMAP Support    Enabled
MMAP File Mask  /dev/zero
Locking type    pthread mutex Locks
Serialization Support   php

Directive   Local Value Master Value
apc.cache_by_default    On  On
apc.canonicalize    On  On
apc.coredump_unmap  Off Off
apc.enable_cli  On  On
apc.enabled On  On
apc.file_md5    Off Off
apc.file_update_protection  2   2
apc.filters no value    no value
apc.gc_ttl  3600    3600
apc.include_once_override   On  On
apc.lazy_classes    Off Off
apc.lazy_functions  Off Off
apc.max_file_size   1M  1M
apc.mmap_file_mask  /dev/zero   /dev/zero
apc.num_files_hint  1024    1024
apc.preload_path    no value    no value
apc.report_autofilter   Off Off
apc.rfc1867 On  On
apc.rfc1867_freq    0   0
apc.rfc1867_name    APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_ upload_
apc.rfc1867_ttl 3600    3600
apc.serializer  default default
apc.shm_segments    1   1
apc.shm_size    30M 30M
apc.slam_defense    On  On
apc.stat    On  On
apc.stat_ctime  Off Off
apc.ttl 7200    7200
apc.use_request_time    On  On
apc.user_entries_hint   4096    4096
apc.user_ttl    7200    7200
apc.write_lock  On  On

cgi-fcgi

Directive   Local Value Master Value
cgi.check_shebang_line  1   1
cgi.fix_pathinfo    1   1
cgi.force_redirect  1   1
cgi.nph 0   0
cgi.redirect_status_env  no value   no value
cgi.rfc2616_headers 0   0
fastcgi.logging 1   1

I would like to use boost + memcache + apc eventually but currently I have a problem enabling apc on httpd with fastcgi.

2 Answers 2

2

We finally managed to set this up properly.

Apc works fine for multiple processes with apache/2 + php 5.3.x + php-fpm + fcgi in FPM/FastCGI mode.

PHP 5.3.x is configured with following options --enable-force-cgi-redirect --enable-fastcgi --enable-fpm

1

I wrote a blog post about this a a few weeks ago, might be useful to some as it goes into a bit more detail. It uses shared memory for APC rather than anonymous mmapped memory (When apc.mmap_file_mask = /dev/zero). This may be better for performance but I was unable to find a conclusive answer.

Also I think that anonymously mmapped memory might not be shared amongst the FPM children, but it may have just been something else I did wrong / came across when doing this setup. Before I used shared memory, I would usually be served by the same PHP process when accessing the APC status page, but if I left it a while and tried again, the APC status page would show a different value for apc.mmap_file_mask, which would mean there was more than one APC cache being used overall since I had not restarted PHP-FPM in this time. Though again, I'm not certain about this.

Anyway, how I setup Apache MPM Worker, PHP-FPM, FastCGI and APC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.