Installation
This » PECL extension is not bundled with PHP.
Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/apc.
A DLL for this PECL extension is currently unavailable. See also the building on Windows section.
Note: On Windows, APC needs a temp path to exist, and be writable by the web server. It checks the TMP, TEMP and USERPROFILE environment variables in that order and finally tries the WINDOWS directory if none of those are set.
Note: For more in-depth, highly technical implementation details, see the » developer-supplied TECHNOTES file .
Коментарии
debian etch installation
apt-get install apache2
apt-get install libapache2-mod-php5
apt-get install php-pear
apt-get install php5-dev
apt-get install make
apt-get install apache2-prefork-dev
pecl install apc
apache2-prefork-dev is necessary for not having the
"Sorry, I was not able to successfully run APXS."
error
On Ubuntu I had to install the apache2-threaded-dev package. It's the the Etch repos.
sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart
Was enough for me. I use Ubuntu Server 8.10.
On Gentoo,
# emerge pecl-apc
Check installation:
$ php -r 'phpinfo();' |grep apc
additional .ini files parsed => /etc/php/cli-php5/ext-active/apc.ini,
apc
apc.cache_by_default => On => On
apc.coredump_unmap => Off => Off
apc.enable_cli => Off => Off
apc.enabled => On => On
apc.file_update_protection => 2 => 2
apc.filters => no value => no value
apc.gc_ttl => 3600 => 3600
apc.include_once_override => Off => Off
apc.max_file_size => 1M => 1M
apc.num_files_hint => 1024 => 1024
apc.report_autofilter => Off => Off
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.shm_segments => 1 => 1
apc.shm_size => 30 => 30
apc.slam_defense => 0 => 0
apc.stat => On => On
apc.stat_ctime => Off => Off
apc.ttl => 7200 => 7200
apc.user_entries_hint => 4096 => 4096
apc.user_ttl => 7200 => 7200
apc.write_lock => On => On
suhosin.apc_bug_workaround => Off => Off
Installed successfully on different FreeBSD servers, with mmap and IPC semaphores, but I got an error on a 64 bits box :
apc_sem_create: semctl(65536,...) failed: Result too large
I had to increase maximum semaphore value :
# sysctl kern.ipc.semvmx=131068
kern.ipc.semvmx: 32767 -> 131068
# echo "kern.ipc.semvmx=131068" >> /etc/sysctl.conf
Works like a charm.
When installing on Plesk and cPanel machines, I get the following error message:
[root@web1 ~]# 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: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
/usr/bin/phpize: /tmp/pear/temp/APC/build/shtool: /bin/sh: bad interpreter: Permission denied
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
The problem is caused by the /tmp/ filesystem being mounted noexec, which keeps any programs on /tmp/ from being allowed to be executed, which breaks the install script.
To remount /tmp/ as executable, use:
[root@web1 ~]# mount -o remount,exec,suid /tmp
The it should install correctly.
After the install is done, remount the /tmp/ filesystem with the noexec permissions reset.
[root@web1 ~]# mount -o remount,noexec,nosuid /tmp
Pay attention to the fact that installing php-apc package gives you APC version 3.1.3p1, which is according to http://pecl.php.net/package/APC UNSTABLE. If you want the latest STABLE edition (3.1.9 by now), you should use 'sudo pecl install apc' instead.
On my Debian Squeeze 64-bit I also had to install the package "apache2-threaded-dev" with this command "apt-get install apache2-threaded-dev". Afterwards I did "pecl install apc" and everything seemed to work fine.
Install successfully on RHEL5 with user-defined path. In case someone needs it, I put the steps here.
I am not the su user and don't have its right too. Basically I installed the Apache and PHP 5.3.10 on the folder under my user directory.
My user directoy like /home/dxxx, php is at /home/dxxx/php, apache is at /home/dxxx/php.
1: I get APC-3.1.9.tar.gz from PECL and put in at /home/dxxx/php/etc.
2: /home/dxxx/php/etc: tar -xvfz APC-3.1.9.tar.gz
3: We get a folder named APC-3.1.9, then cd APC-3.1.9
4: /home/dxxx/php/etc/APC-3.1.9: /home/dxxx/php/bin/./phpize ( because I installed php on user-defined foler, need to go there to find the "phpize")
It shows:
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
5: /home/dxxx/php/etc/APC-3.1.9: ./config --with-php-config=/home/dxxx/php/bin/php-config --enable-apc --enable-apc-debug ( Because I am asked to put --with-php-config=PATH, if I don't provide it)
--Ignore the output message
6: /home/dxxx/php/etc/APC-3.1.9: make
We should be able to see a "apc.so" file under modules/.
7: /home/dxxx/php/etc/APC-3.1.9: make install
This step copies that "apc.so" file to your extension folder. We can do it manually either.
8: Add extension=apc.so to you php.ini, then restart the apache server
9: /home/dxxx/php/etc/APC-3.1.9: /home/dxxx/php/bin/./php -m
We should be able to see the "apc" on the list
Installation Steps For on Centos 6.3 / PHP 5.3.3
#use pecl to install it (you will be prompted during installation, I used the default values)
pecl install apc
# you should see something like this
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
54 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
...
...
...
Build process completed successfully
Installing '/usr/lib64/php/modules/apc.so'
Installing '/usr/include/php/ext/apc/apc_serializer.h'
install ok: channel://pecl.php.net/APC-3.1.9
#Great now that it is built,
#enable apc in php.ini
nano /etc/php.ini
# somewhere in you php.ini file add please not that path may be different for you installation
extension="/usr/lib64/php/modules/apc.so"
apc.enabled=1
# copy the shipped apc.php to see what is going on wit apc on your server
cp /usr/share/pear/apc.php /root_dir_of_your_web_app
# now you should be able to see stats of APC running
The below steps should work on Red Hat Enterprise Linux (RHEL) 6.x / CentOS 6.x. By way of introduction I had a bit of trouble installing php-devel but finally found an RPM on pbone.net that wold work with my version of php...
# yum install gcc automake php httpd httpd-devel
# yum list installed | grep php
# rpm -Uvh ftp://ftp.sunet.se/pub/Linux/distributions/scientific/6.3/x86_64/updates/security/php-devel-5.3.3-27.el6_5.x86_64.rpm
With that out ofthe way, I could continue the installation of APC...
# yum install php-pear
# pecl install apc
# echo "extension=apc.so" >> /etc/php.ini
# echo "apc.enabled=1" >> /etc/php.ini
# cp /usr/share/pear/apc.php /var/www/html/apc.php (this step is optional)
# /etc/init.d/httpd restart
Finally, test opening the apc.php file in a Web browser if you opted to copy the file. If all goes well, you may want to delete the apc.php file when you're done.
-nick
After spending a few hours investigating this I have come to learn that as of php 5.5, there is an opcode cache built into php that you should use instead of wrestling with trying to install this one. Especially on WAMP.