8

Here my config

extension = apc.so

apc.enabled = 1
apc.shm_size = 128M
apc.shm_segments = 1
apc.gc_ttl = 7200
apc.ttl = 0
apc.num_files_hint = 1024
apc.file_update_protection = 2
apc.max_file_size = 5M
apc.stat_ctime = 1
apc.mmap_file_mask=/tmp/apc.XXXXXX

apc.filter="-/usr/share/phpMyAdmin/.*"

APC INFO: APC Version 3.1.3p1 PHP Version 5.3.3 APC Host .._._ (mysite.com) (127.0.0.1) Server Software Apache/2.2.15 (CentOS) Shared Memory 1 Segment(s) with 30.0 MBytes (mmap memory, pthread mutex locking)

Runtime Settings apc.shm_size 128M

[root@mysite.com ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.tcp_syncookies = 1
kernel.shmmax = 134217728

What i must do to increase APC memory?

tarlyun
  • 83
  • 1
  • 1
  • 3
  • Increase `apc.shm_segments`, not the segment size. Some operating systems have low limit on shared memory segment, your seems to have it set at 32 megs. – N.B. Dec 28 '11 at 09:15
  • 3
    I try: `apc.shm_size = 128M apc.shm_segments = 2`, `apc.shm_size = 32M apc.shm_segments = 4`, and other... APC still use only 32M – tarlyun Dec 28 '11 at 10:07
  • with or without the M doesn't work for me. regardless of what I put, apc.php still shows a shm size of 32M. any ideas why? I have the current version of apc and php 5.4.36 – shaiss Feb 12 '15 at 02:13

3 Answers3

7

Have a look at the manual: https://www.php.net/manual/en/apcu.configuration.php, furthermore, note the difference between size and maximum size.

baikho
  • 5,203
  • 4
  • 40
  • 47
The Nail
  • 8,355
  • 2
  • 35
  • 48
  • 10
    Eureka! Work fine without **M**. Lines: `apc.shm_size = 128 apc.shm_segments = 1` – tarlyun Dec 28 '11 at 10:19
  • 1
    Finally! This is strange, because it works with "M" on some platforms (like Amazon Linux) and doesn't work on Ubuntu. It is because PHP version which comes with those distros are different. Took me some time to figure out :) – Anton Babenko Mar 05 '12 at 15:59
  • @shaiss please add your question as a comment to T0xicCode's answer on removing the "M". I was just linking to the documentation. – The Nail Feb 11 '15 at 11:06
2

It seems , at least in my case , that for this to work I have to add it to apcu.ini found in mods-available php folder(depending on version used) like this :

extension=apcu.so
apc.shm_size = "64M"
jirarium
  • 182
  • 2
  • 7
  • This one worked for me. It's very strange and says a lot about PHP as a language. As a separate comment, php.net offers the worst documentation I've seen. – Jiulin Teng Dec 12 '20 at 11:23
1

I'll repeat the solution here (because it was listed as a comment of the accepted solution):

You might need to remove the "M" from the apc.shm_size configuration value. The number is expected to be in megabytes, and some php versions will fail to parse the value and revert to the default (30 or 32 MB) if the given value is not a number.

T0xicCode
  • 4,583
  • 2
  • 37
  • 50