2011-12-22 80 views
7

我按照這個教程http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/在我的centos vps主機上安裝了apc,但在最後一步我收到了一些錯誤信息。這裏是從終端的完整日誌:在linux/centos上安裝apc for php時出錯

/bin/sh /usr/local/src/APC-3.1.9/libtool --mode=compile cc -I. -I/usr/local/src/APC-3.1.9 -DPHP_ATOM_INC -I/usr/local/src/APC-3.1.9/include -I/usr/local/src/APC-3.1.9/main -I/usr/local/src/APC-3.1.9 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/APC-3.1.9/apc.c -o apc.lo 
mkdir .libs 
cc -I. -I/usr/local/src/APC-3.1.9 -DPHP_ATOM_INC -I/usr/local/src/APC-3.1.9/include -I/usr/local/src/APC-3.1.9/main -I/usr/local/src/APC-3.1.9 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/APC-3.1.9/apc.c -fPIC -DPIC -o .libs/apc.o 
In file included from /usr/local/src/APC-3.1.9/apc.c:44: 
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory 
In file included from /usr/local/src/APC-3.1.9/apc.c:44: 
/usr/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 
/usr/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 
/usr/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre' 
/usr/local/src/APC-3.1.9/apc.c:393: error: expected specifier-qualifier-list before 'pcre' 
/usr/local/src/APC-3.1.9/apc.c: In function 'apc_regex_compile_array': 
/usr/local/src/APC-3.1.9/apc.c:454: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:454: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:455: error: 'apc_regex' has no member named 'nreg' 
/usr/local/src/APC-3.1.9/apc.c:455: error: 'apc_regex' has no member named 'nreg' 
/usr/local/src/APC-3.1.9/apc.c: In function 'apc_regex_match_array': 
/usr/local/src/APC-3.1.9/apc.c:487: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:487: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:488: error: 'apc_regex' has no member named 'nreg' 
/usr/local/src/APC-3.1.9/apc.c:488: error: 'apc_regex' has no member named 'nreg' 
make: *** [apc.lo] Error 1 
[[email protected] APC-3.1.9]# make install 
/bin/sh /usr/local/src/APC-3.1.9/libtool --mode=compile cc -I. -I/usr/local/src/APC-3.1.9 -DPHP_ATOM_INC -I/usr/local/src/APC-3.1.9/include -I/usr/local/src/APC-3.1.9/main -I/usr/local/src/APC-3.1.9 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/APC-3.1.9/apc.c -o apc.lo 
cc -I. -I/usr/local/src/APC-3.1.9 -DPHP_ATOM_INC -I/usr/local/src/APC-3.1.9/include -I/usr/local/src/APC-3.1.9/main -I/usr/local/src/APC-3.1.9 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/APC-3.1.9/apc.c -fPIC -DPIC -o .libs/apc.o 
In file included from /usr/local/src/APC-3.1.9/apc.c:44: 
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory 
In file included from /usr/local/src/APC-3.1.9/apc.c:44: 
/usr/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 
/usr/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 
/usr/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre' 
/usr/local/src/APC-3.1.9/apc.c:393: error: expected specifier-qualifier-list before 'pcre' 
/usr/local/src/APC-3.1.9/apc.c: In function 'apc_regex_compile_array': 
/usr/local/src/APC-3.1.9/apc.c:454: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:454: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:455: error: 'apc_regex' has no member named 'nreg' 
/usr/local/src/APC-3.1.9/apc.c:455: error: 'apc_regex' has no member named 'nreg' 
/usr/local/src/APC-3.1.9/apc.c: In function 'apc_regex_match_array': 
/usr/local/src/APC-3.1.9/apc.c:487: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:487: error: 'apc_regex' has no member named 'preg' 
/usr/local/src/APC-3.1.9/apc.c:488: error: 'apc_regex' has no member named 'nreg' 
/usr/local/src/APC-3.1.9/apc.c:488: error: 'apc_regex' has no member named 'nreg' 

任何想法?

+0

你是如何解決這個問題的,你能分享一下嗎? – Hunt 2012-03-21 19:18:56

回答

13

我有同樣的問題,我發現這在CentOS 6.2的工作:

sudo yum install php-pear 
sudo yum install php-devel 
sudo yum install httpd-devel 
sudo yum install gcc 
sudo yum install pcre-devel 
sudo pecl install apc-beta 

完整的帖子在這裏:http://www.accella.net/installing-apc-on-centos-5/

19

用途:

apt-get install libpcre3-dev 

yum install pcre-devel 
+0

+1這工作對我來說 – 2012-10-28 09:45:41

+0

+1,爲我工作(CentOS 6.5) – xmak 2014-05-03 16:42:16

+0

+1,它的工作對我來說是centos – 2014-08-07 17:21:52

0

我使用雷米庫。 (CentOS版本6.5,PHP 5.4) 您可以通過以下命令

yum --enablerepo=remi list php54* 
yum --enablerepo=remi list php54* | grep apc 

我得到了以下的APC包

php54-php-pecl-apcu.x86_64  4.0.7-1.el6.remi   @remi 

現在你可以用下面的命令來安裝APC

yum install php54-php-pecl-apcu --enablerepo=remi 
列出可用的包