Two days back i have installed Alternative PHP Cache on FreeBSD 6 server.
Alternative PHP Cache is used to speed up PHP script execution.
You can find more about APC at
On FreeBSD 6, its available on ports tree.
Port: pecl-APC-3.0.8_1
Path: /usr/ports/www/pecl-APC
Info: Alternative PHP Cache
Maint: mnag@FreeBSD.org
B-deps: apache-1.3.34_4 autoconf-2.59_2 expat-2.0.0_1 m4-1.4.4 perl-5.8.8 php4-4.4.2_1
R-deps: apache-1.3.34_4 expat-2.0.0_1 perl-5.8.8 php4-4.4.2_1
WWW: http://pecl.php.net/package/APC
Path: /usr/ports/www/pecl-APC
Info: Alternative PHP Cache
Maint: mnag@FreeBSD.org
B-deps: apache-1.3.34_4 autoconf-2.59_2 expat-2.0.0_1 m4-1.4.4 perl-5.8.8 php4-4.4.2_1
R-deps: apache-1.3.34_4 expat-2.0.0_1 perl-5.8.8 php4-4.4.2_1
WWW: http://pecl.php.net/package/APC
I have installed it with
server24# cd /usr/ports/www/pecl-APC
server24# make
server24# make install
server24# make
server24# make install
After installing, i have edited /usr/local/etc/php.ini and added following entry
apc.enabled=”1″
apc.shm_size=”30″
apc.shm_size=”30″
Everything works fine, in phpinfo, i got a section saying
apc
APC Support enabled
Version 3.0.8
MMAP Support Disabled
Revision $Revision: 3.68 $
Build Date Mar 8 2006 20:46:13
APC Support enabled
Version 3.0.8
MMAP Support Disabled
Revision $Revision: 3.68 $
Build Date Mar 8 2006 20:46:13
After after two days, i found Apache getting down. I checked the apache error log at /var/log/httpd-error.log and found following error message
[Sat Mar 11 00:00:02 2006] [apc-error] apc_shm_create: shmget(0, 31457280,914) failed: Cannot allo
cate memory. It is possible that the chosen SHM segment size is higher than the operation system a
llows. Linux has usually a default limit of 32MB per segment.
[Sat Mar 11 15:30:13 2006] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Mar 11 15:30:14 2006] [notice] Digest: generating secret for digest authentication …
[Sat Mar 11 15:30:14 2006] [notice] Digest: done
[Sat Mar 11 15:30:15 2006] [warn] pid file /var/run/httpd.pid overwritten — Unclean shutdown of p
revious Apache run?
cate memory. It is possible that the chosen SHM segment size is higher than the operation system a
llows. Linux has usually a default limit of 32MB per segment.
[Sat Mar 11 15:30:13 2006] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Mar 11 15:30:14 2006] [notice] Digest: generating secret for digest authentication …
[Sat Mar 11 15:30:14 2006] [notice] Digest: done
[Sat Mar 11 15:30:15 2006] [warn] pid file /var/run/httpd.pid overwritten — Unclean shutdown of p
revious Apache run?
Some thing wrong with APC, so i uninstalled it
server24# cd /usr/ports/www/pecl-APC
server24# make deinstall
server24# make deinstall
Then edited /usr/local/etc/php.ini and removed following lines.
apc.enabled=”1″
apc.shm_size=”30″
apc.shm_size=”30″
I have been using eaccelerator with out any problem on my other servers, so have installed it, lets see if Apache have any problem with it.
Related posts:

in perl-APC’s install document it says “apc.shm_size
The size of each shared memory segment in MB.By default, some systems (including most BSD variants) have very low limits on the size of a shared memory segment. Default: 30)”
it sounds like FreeBSD’s problem,
I am still trying how to solve this problem….