HOW-TO: Install APC

Gander

Verified User
Joined
Aug 2, 2009
Messages
15
Location
Warsaw, Poland
My config: Debian 5 + Apache 2.2 + PHP 5 CLI + Zend Engine v2 + DA 1.35

  1. Install autoconf:
    Code:
    apt-get install autoconf
  2. Install APC using PECL:
    Code:
    pecl install apc
  3. After install process we have messages like this:
    Code:
    Build process completed successfully
    Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so'
    install ok: channel://pecl.php.net/APC-3.0.19
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=apc.so" to php.ini
  4. Edit php.ini (via DA or directly: /usr/local/lib/php.ini)
    • modify extension_dir directive:
      Code:
      ; Directory in which the loadable extensions (modules) reside.
      extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
    • Enable extension apc.so:
      Code:
      extension=apc.so
  5. Restart HTTPD (via DA)
  6. Check in phpinfo() is apc enabled?
    Code:
    apc
    APC Support 	enabled
    Version 	3.0.19
    MMAP Support 	Enabled
    MMAP File Mask 	no value
    Locking type 	pthread mutex Locks
    Revision 	$Revision: 3.154.2.5 $
    Build Date 	Apr 4 2010 09:44:56


Sources:
DirectAdmin Forums: apc.rfc1867 apparently ignoring me
MacPorts: php5's extension_dir INI variable is incorrect
 

Gander

Verified User
Joined
Aug 2, 2009
Messages
15
Location
Warsaw, Poland
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.
 

dimitrivisser

New member
Joined
Apr 11, 2011
Messages
2
Thank you for the tutorial! I am trying to change the APC configuration but there is no apc.ini installed and I also cannot find the location where I can make it myself. I tried to put it in several directories without any luck...
Do you know the right location for the apc.ini ?
 

dimitrivisser

New member
Joined
Apr 11, 2011
Messages
2
I installed APC with Centos. I found out apc.ini isn't neccesary, you can put all APC settings in php.ini.
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Not quite; Debian uses apt-get, and CentOS uses yum. The package names may be different.

Jeff
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,818
Location
GMT +7.00
That goes without saying Jeff, I guess. Anyway it's good that you mentioned the fact.
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,789
Location
A Coruña, Spain
Any hint for PHP 5.3?

>pecl install apc
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
.................................done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
/usr/local/bin/phpize: /tmp/pear/temp/APC/build/shtool: /bin/sh: bad interpreter: Permission denied
Cannot find autoheader. Please check your autoconf installation and the
$PHP_AUTOHEADER environment variable. Then, rerun this script.

ERROR: `phpize' failed

autoconf is correctly installed using yum.
Ive tryed to export that variable in different path but actually the same error always appear.

Any ideas?

PS. yes i was root.. bad interpreter make me think aswell but dunno how to act.

Thanks
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,789
Location
A Coruña, Spain
Oh.. right...

/dev/sda3 on /tmp type ext3 (rw,noexec,nosuid)

there a way to let it run from other path or ive to enable exec from tmp for the installation?

Regards
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,818
Location
GMT +7.00
Code:
# pecl help options
Options:
     -v         increase verbosity level (default 1)
     -q         be quiet, decrease verbosity level
     -c file    find user configuration in `file'
     -C file    find system configuration in `file'
     -d foo=bar set user config variable `foo' to `bar'
     -D foo=bar set system config variable `foo' to `bar'
     -G         start in graphical (Gtk) mode
     -s         store user configuration
     -S         store system configuration
     -u foo     unset `foo' in the user configuration
     -h, -?     display help/usage (this message)
     -V         version information
Check -c file find user configuration in `file'
 
Top