centos下编译安装php apc

39次阅读
没有评论

首先下载一个php apc安装包,下载地址:

http://pecl.php.net/package/APC

解压:

tar -xzvf APC-3.1.9.tgz
cd APC-3.1.9

安装:

/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make && make install

这一步如果不加–with-php-config这个参数的话,有可能会报”configure: error: Cannot find php-config. Please use Cwith-php-config=PATH”错误,说明PHP配置文件位置可能不在缺省目录(Cwith-php-config预设在/usr/bin /php-config),这里我们只要指定–with-php-config这个参数就可以了,一般在PHP的安装目录的bin目录下有一个php-config文件夹。

配置PHP:
在php apc编译结束后我们将会看到如下输出信息:

Build complete.
Don’t forget to run ‘make test’.

Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
Installing header files:/usr/local/php/include/php/

我们将shared extensions路径(/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/)打开,可以看到里面有一个刚生成好的apc.so。
然后在PHP的配置文件php.ini中加入如下配置:
extension = “apc.so”
重启php服务
php-fpm restart
刷新php探针,,
APC 显示3.1.13
我们安装成功来

正文完