Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing apc for php on linux/centos

Tags:

php

apc

I followed this tutorial http://stevejenkins.com/blog/2011/08/how-to-install-apc-alternative-php-cache-on-centos-5-6/ to install apc on my centos vps hosting but I get some error messages on the last step. Here is the complete log from the terminal:

/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
[root@lvps178-77-79-75 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'

Any ideas?

like image 374
King Julien Avatar asked Dec 22 '11 15:12

King Julien


2 Answers

USE:

apt-get install libpcre3-dev

yum install pcre-devel
like image 83
Max Małecki Avatar answered Oct 27 '22 16:10

Max Małecki


I had the same problem, and I found this to work on 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

Complete post here: http://www.accella.net/installing-apc-on-centos-5/

like image 24
fed Avatar answered Oct 27 '22 18:10

fed