安裝 apc 套件
今天程式部門要求安裝 apc 套件,雖然我是使用 debian 4.0,但是 apt-cache search 也找不到 apc 相關套件,google 了一下之後知道原來是 php 相關的,但是還是找不到阿,之前用 debian 3.0 的時候程式部門說要 Mysql 5.x+php5,但是 3.0 的 stable 並沒有這麼新的版本,所以網路上的人說可以使用 http://dotdeb.org/ 的套件,所以有 php5-apc,但是現在都是使用新版的 debian 4.0,官方是沒有這個套件,所以接下來就使用 php-pear 來安裝 apc 嚕。
首先來安裝 php-pear 套件
apt-get install php-pear
然後再使用
pear install apc
來安裝 apc,過了很久都沒有回應,原來要改用
pecl install apc
pecl install apc
downloading APC-3.0.14.tgz …
Starting to download APC-3.0.14.tgz (108,511 bytes)
…………………….done: 108,511 bytes
40 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Use apxs to set compile flags (if using APC with Apache)? [yes] :
……
……
…..
….
….
Sorry, I was not able to successfully run APXS. Possible reasons:
1. Perl is not installed;
2. Apache was not compiled with DSO support (–enable-module=so);
3. ‘apxs’ is not in your path. Try to use –with-apxs=/path/to/apxs
The output of apxs follows
/tmp/pear/cache/APC-3.0.14/configure: line 3845: apxs: command not found
configure: error: Aborting
ERROR: `/tmp/pear/cache/APC-3.0.14/configure –with-apxs’ failed
最後卻出現了錯誤訊息,原來是沒有 apxs 可以裝進 apache2,所以再裝 apache-dev
apt-get install apache2-dev (apache-dev)
最後再重新安裝一次 apc
pecl install apc
最後出現
Build process completed successfully
Installing ‘/var/tmp/pear-build-root/install-APC-3.0.14//usr/lib/php5/20060613+lfs/apc.so’
install ok: channel://pecl.php.net/APC-3.0.14
You should add “extension=apc.so” to php.ini
在 /etc/php5/apache2/php.ini 裡面加入 extension=apc.so 就 ok 嚕。
重起 apache2 之後,再來編輯檔案做個 phpinfo() 查看,有看到 apc 區段就好了。




