tomdchi

Well-Known Member
Feb 24, 2008
142
4
68
Atlanta, GA
cPanel Access Level
DataCenter Provider
I get the error below when trying to install APC via WHM PECL installer

Anyone have any idea how to fix this?

Code:
running: make
/bin/sh /root/tmp/pear-build-root/APC-3.0.19/libtool --mode=compile cc -m64 -fPIC -DPIC -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear-build-root/APC-3.0.19/include -I/root/tmp/pear-build-root/APC-3.0.19/main -I/root/tmp/pear/APC -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 /root/tmp/pear/APC/apc.c -o apc.lo
mkdir .libs
 cc -m64 -fPIC -DPIC -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear-build-root/APC-3.0.19/include -I/root/tmp/pear-build-root/APC-3.0.19/main -I/root/tmp/pear/APC -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 /root/tmp/pear/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
/bin/sh /root/tmp/pear-build-root/APC-3.0.19/libtool --mode=compile cc -m64 -fPIC -DPIC -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear-build-root/APC-3.0.19/include -I/root/tmp/pear-build-root/APC-3.0.19/main -I/root/tmp/pear/APC -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 /root/tmp/pear/APC/php_apc.c -o php_apc.lo
 cc -m64 -fPIC -DPIC -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear-build-root/APC-3.0.19/include -I/root/tmp/pear-build-root/APC-3.0.19/main -I/root/tmp/pear/APC -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 /root/tmp/pear/APC/php_apc.c  -fPIC -DPIC -o .libs/php_apc.o
/root/tmp/pear/APC/php_apc.c:959: error: duplicate 'static'
make: *** [php_apc.lo] Error 1
ERROR: `make' failed
The APC.so object is not in /usr/local/lib/php/extensions/no-debug-non-zts-20090626
 

tomdchi

Well-Known Member
Feb 24, 2008
142
4
68
Atlanta, GA
cPanel Access Level
DataCenter Provider
[SOLVED]APC install error

After a week I finally got it worked out. Aparently this is a common problem and I thought I would share how I got it to work since I had to cobble together different steps from different sources to get it to install.

Server set up: cPanel/WHM, Centos 5.5, with php 5.3.3

If you are trying to install APC are not able to using the WHM PECL installer then try this. APC needs to be installed from source so these instructions assume you have root access to the server using a client like putty.

login to server as root and run the following commands:

Code:
cd ~ 
mkdir setups
cd setups 
wget http://pecl.php.net/get/APC-3.1.5.tgz 
tar -xvf APC-3.1.5.tgz 
cd APC-3.1.5
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php config=/usr/local/bin/php-config
make
if you get the error:
Code:
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/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.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:52: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c:362: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_compile_array':
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_match_array':
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
Then you need to install pcre and make sure you do this from the / directory or it will not install.
Code:
yum install pcre-devel
Again do:
Code:
make
If no errors then do:
Code:
make install
update php.ini through WHM PHP Configuration Editor. Switch to Advanced and find Section:Core Directive:extension and add this to the end of the list:
Code:
, apc.so
Then restart apache and your done. the phpinfo function should show that APC is installed

Hope this helps someone.
 

garrettp

Well-Known Member
PartnerNOC
Jun 18, 2004
312
1
166
cPanel Access Level
DataCenter Provider
Re: [SOLVED]APC install error

After a week I finally got it worked out. Aparently this is a common problem and I thought I would share how I got it to work since I had to cobble together different steps from different sources to get it to install.

Server set up: cPanel/WHM, Centos 5.5, with php 5.3.3

If you are trying to install APC are not able to using the WHM PECL installer then try this. APC needs to be installed from source so these instructions assume you have root access to the server using a client like putty.

login to server as root and run the following commands:

Code:
cd ~ 
mkdir setups
cd setups 
wget http://pecl.php.net/get/APC-3.1.5.tgz 
tar -xvf APC-3.1.5.tgz 
cd APC-3.1.5
phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php config=/usr/local/bin/php-config
make
if you get the error:
Code:
In file included from /usr/local/src/APC-3.1.5/apc.c:38:
/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.5/apc.c:38:
/usr/include/php/ext/pcre/php_pcre.h:45: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
/usr/include/php/ext/pcre/php_pcre.h:52: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c:362: error: expected specifier-qualifier-list before 'pcre'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_compile_array':
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:419: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:420: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c: In function 'apc_regex_match_array':
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:452: error: 'apc_regex' has no member named 'preg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
/usr/local/src/APC-3.1.5/apc.c:453: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
Then you need to install pcre and make sure you do this from the / directory or it will not install.
Code:
yum install pcre-devel
Again do:
Code:
make
If no errors then do:
Code:
make install
update php.ini through WHM PHP Configuration Editor. Switch to Advanced and find Section:Core Directive:extension and add this to the end of the list:
Code:
, apc.so
Then restart apache and your done. the phpinfo function should show that APC is installed

Hope this helps someone.
Just a note here, you couldn't build the WHM APC because the version the WHM was pulling from it's PECL repo that was stable at the time (3.0.19) did not support PHP 5.3.x. It wasn't until the APC 3.1 betas that PHP 5.3.x was supported.

APC is now stable at 3.1.6, has full PHP 5.3.x support, and this is the version now installed by the WHM PECL installer.
 

luigidelgado

Well-Known Member
Nov 6, 2010
119
5
68
Mexico
cPanel Access Level
Root Administrator
Twitter
Hummm.... I have updated all my WHM/cPanel Software but I can't find APC anywhere... nor in "PHP Pecl" nor in "PHP Extensions and Applications Package"... am I missing something??

I read about APC and it's a great performance extension. Good to know PHP 6 will have it by default.
 

hbouma

Well-Known Member
Jun 8, 2002
61
1
308
Re: [SOLVED]APC install error

Then you need to install pcre and make sure you do this from the / directory or it will not install.
Because cPanel installs its own version of pcre that it uses to build PHP, don't you run the risk of using a different version of pcre when you do this which may cause problems? Why not just find a way to use the version in /opt that cpanel is using for building apache/php ?

APC is now stable at 3.1.6, has full PHP 5.3.x support, and this is the version now installed by the WHM PECL installer.
Actually, WHM wants to install 3.1.7 which is the beta version when I try it from there. It would be nice if they didn't try to pull beta versions from the pecl repo.

Hal
 

luigidelgado

Well-Known Member
Nov 6, 2010
119
5
68
Mexico
cPanel Access Level
Root Administrator
Twitter
Re: [SOLVED]APC install error

Actually, WHM wants to install 3.1.7 which is the beta version when I try it from there. It would be nice if they didn't try to pull beta versions from the pecl repo.

Hal
Depends on your UPDATE settings, if you have preference for STABLE versions you will get 3.1.6...

Still having some dificulties here... I finally just placed "APC" in the Pecl SEARCH in cPanel and installation began but had errors with CLI, does anybody know how may I solve this?:

Code:
downloading APC-3.1.6.tgz ...
Starting to download APC-3.1.6.tgz (148,835 bytes)
.............done: 148,835 bytes
49 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Enable per request file info about files used from the APC cache [no] : 
[COLOR="red"]Notice: Use of undefined constant STDIN - assumed 'STDIN' in PEAR/Frontend/CLI.php on line 304

Warning: fgets() expects parameter 1 to be resource, string given in PEAR/Frontend/CLI.php on line 304

Warning: fgets() expects parameter 1 to be resource, string given in /usr/lib/php/PEAR/Frontend/CLI.php on line 304
Enable spin locks (EXPERIMENTAL) [no] : 
Notice: Use of undefined constant STDIN - assumed 'STDIN' in PEAR/Frontend/CLI.php on line 304

Warning: fgets() expects parameter 1 to be resource, string given in PEAR/Frontend/CLI.php on line 304

Warning: fgets() expects parameter 1 to be resource, string given in /usr/lib/php/PEAR/Frontend/CLI.php on line 304[/COLOR]
building in /root/tmp/pear/pear-build-root8jbTu8/APC-3.1.6
running: /root/tmp/pear/APC/configure --enable-apc-filehits=no --enable-apc-spinlocks=no
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ANSI C... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -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
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... invalid
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable APC support... yes, shared
checking whether we should enable cache request file info... no
checking whether we should use mmap... yes
checking whether we should use semaphore locking instead of fcntl... no
checking whether we should use pthread mutex locking... yes
pthread mutex's are supported!
checking whether we should use spin locks... no
checking whether we should enable memory protection... no
checking for zend_set_lookup_function_hook... no
checking for sigaction... yes
checking for union semun... no
checking whether we should enable valgrind support... checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
yes
checking valgrind/memcheck.h usability... no
checking valgrind/memcheck.h presence... no
checking for valgrind/memcheck.h... no
checking for shm_open in -lrt... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /root/tmp/pear/pear-build-root8jbTu8/APC-3.1.6/libtool --mode=compile cc  -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-root8jbTu8/APC-3.1.6/include -I/root/tmp/pear/pear-build-root8jbTu8/APC-3.1.6/main -I/root/tmp/pear/APC -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 /root/tmp/pear/APC/apc.c -o apc.lo
mkdir .libs
 cc -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-root8jbTu8/APC-3.1.6/include -I/root/tmp/pear/pear-build-root8jbTu8/APC-3.1.6/main -I/root/tmp/pear/APC -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 /root/tmp/pear/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
In file included from /root/tmp/pear/APC/apc.c:44:
[COLOR="red"]/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /root/tmp/pear/APC/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'
/root/tmp/pear/APC/apc.c:369: error: expected specifier-qualifier-list before 'pcre'
/root/tmp/pear/APC/apc.c: In function 'apc_regex_compile_array':
/root/tmp/pear/APC/apc.c:430: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:430: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:431: error: 'apc_regex' has no member named 'nreg'
/root/tmp/pear/APC/apc.c:431: error: 'apc_regex' has no member named 'nreg'
/root/tmp/pear/APC/apc.c: In function 'apc_regex_match_array':
/root/tmp/pear/APC/apc.c:463: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:463: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:464: error: 'apc_regex' has no member named 'nreg'
/root/tmp/pear/APC/apc.c:464: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
ERROR: `make' failed[/COLOR]
The apc.so object is not in /usr/local/lib/php/extensions/no-debug-non-zts-20090626
BTW... I havent [SOLVED] it... APC install problems is one of the most indexed thems for APC in Google... After a clean install APC is the Perfect Choice.

I need all performance available, i run a fat-of-images-million-visit-news site.
 
Last edited:

garrettp

Well-Known Member
PartnerNOC
Jun 18, 2004
312
1
166
cPanel Access Level
DataCenter Provider
Re: [SOLVED]APC install error

Because cPanel installs its own version of pcre that it uses to build PHP, don't you run the risk of using a different version of pcre when you do this which may cause problems? Why not just find a way to use the version in /opt that cpanel is using for building apache/php ?



Actually, WHM wants to install 3.1.7 which is the beta version when I try it from there. It would be nice if they didn't try to pull beta versions from the pecl repo.

Hal
My PECL installer on 11.28.87-CURRENT_51188 wants to install 3.1.6. You may want to check your PECL configuration to see if it's set to pull beta/unstable releases.

Code:
12:08:[email protected]:~$ pecl config-show|grep "Preferred Package State"
Preferred Package State        preferred_state  stable
 

garrettp

Well-Known Member
PartnerNOC
Jun 18, 2004
312
1
166
cPanel Access Level
DataCenter Provider
Re: [SOLVED]APC install error

Depends on your UPDATE settings, if you have preference for STABLE versions you will get 3.1.6...

Still having some dificulties here... I finally just placed "APC" in the Pecl SEARCH in cPanel and installation began but had errors with CLI, does anybody know how may I solve this?:

...

BTW... I havent [SOLVED] it... APC install problems is one of the most indexed thems for APC in Google... After a clean install APC is the Perfect Choice.

I need all performance available, i run a fat-of-images-million-visit-news site.
What version of PHP? The fact that phpize is throwing PHP errors tells me there may be an issue with the PHP environment.
 

garrettp

Well-Known Member
PartnerNOC
Jun 18, 2004
312
1
166
cPanel Access Level
DataCenter Provider
Good deal :)
 

villario

Registered
Dec 10, 2006
4
0
151
Hi,

tried pecl install apc and got the errors as above. I then tried the suggestion yum install pcre-devel which installed PCRE again into 5.3.3 and then tried pecl install apc again, and it worked! Thanks tomdchi!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Do you have any RLimitMEM set on the server?

Code:
grep -i rlimit /usr/local/apache/conf/httpd.conf
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
If you are only getting a ServerLimit not RLimitMEM, then you aren't restricted by RLimit for memory on the machine.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
You are receiving a memory size allocation error, which ties into memory limits. One way to limit memory is RLimitMEM in Apache, which is one of the common reasons for that type of error message. Another reason would be a memory limit in /usr/local/lib/php.ini file:

Code:
grep ^memory /usr/local/lib/php.ini
 
Oct 18, 2011
9
0
51
United States
cPanel Access Level
Root Administrator
You are receiving a memory size allocation error, which ties into memory limits. One way to limit memory is RLimitMEM in Apache, which is one of the common reasons for that type of error message. Another reason would be a memory limit in /usr/local/lib/php.ini file:

Code:
grep ^memory /usr/local/lib/php.ini
Looks like the result is:

memory_limit = 32M