APC not caching under nginx and PHP-FPM

I am running nginx 1.0.12, PHP 5.3.10 via PHP-FPM.

I compiled nginx and php5.3.10 myself. Here's my PHP compile config:

'./configure' '--enable-fpm' '--with-fpm-user=nginx' '--with-fpm-group=nginx' '--with-pcre-regex' '--without-sqlite3' '--with-zlib' '--with-bz2=/bin/bzip2' '--with-openssl' '--enable-mbstring' '--with-mysql=/usr' '--with-mysql-sock' '--disable-pdo' '--enable-sockets' '--without-sqlite' '--enable-zip' '--without-pear' '--with-curl' '--with-mcrypt'

PHP info says that APC is enabled:

Version    3.1.3p1
MMAP Support    Enabled
MMAP File Mask    /dev/zero
Locking type    pthread mutex Locks
Revision    $Revision: 286798 $
Build Date    Apr 18 2010 06:44:34

But, loading up apc.php shows no user or system files are being cached:

Cached Files    0 ( 0.0 Bytes)

 Free: 64.0 MBytes (99.9%)     Hits: 1 (100.0%)
 Used: 40.0 KBytes (0.1%)     Misses: 0 (0.0%)

I have tried for hours to find an answer as to why APC is not caching any files. I thought maybe it was permissions on the /tmp folder, so I tried using a new folder (/tmp-apc with 0777 permissions) to no avail. I tried using /dev/zero and it still doesn't work.

Anyone have any idea why APC is not caching any files?

Here is my php.ini APC config:

extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=64
apc.ttl=0
apc.user_ttl=0
apc.num_files_hint=0
apc.enable_cli=0

;apc.mmap_file_mask=/tmp-apc/apc.shm.XXXXXX
apc.mmap_file_mask=/dev/zero
apc.optimization = 0
apc.cache_by_default = 1
apc.use_request_time = 1
apc.include_once_override=1

5 Replies

Maybe replace

apc.shm_size=64 

with

apc.shm_size=64M

I don't recall which version made that change last year.

Unfortunately that didn't work. When I use 64M APC defaults to 30M in my version, so for my version it works without the M.

Are you running every PHP script with the same FPM pool, or have you set up different pools for different websites? Does apc.php share the same pool as the rest of your website(s)? Depending on how you set everything up, your apc.php might be sitting in its own cache.

Just one pool that contains them all. Here's my php-fpm.conf settings:

[www]
user = nginx
group = nginx
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1

I suppose I'd try to run with just extension=apc.so
in the php.ini so that it runs with the defaults.

I assume you've made sure to kill php5-fpm completely and restarted.

What distro, btw? Any special reason for compiling from source?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct