Problem installing APC from Module Installers

cwm1021

Registered
Apr 7, 2007
4
0
151
Hello All,

My WHM version is WHM 11.30.5 (build 2), CENTOS 5.7 x86_64 standard. PHP 5.3.6

I am trying to install APC via:
WHM >> Software >> Module Installers >> PHP Pecl >> search "APC"

But failed, got the error below:

Code:
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
.....................done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Enable internal debugging in APC [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
Enable per request file info about files used from the APC cache [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
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
Enable memory protection (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
Enable pthread mutexes (default) [yes] : 
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 pthread read/write 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
building in /root/tmp/pear/pear-build-rooth5zH7q/APC-3.1.9
running: /root/tmp/pear/APC/configure --enable-apc-debug=no --enable-apc-filehits=no --enable-apc-spinlocks=no --enable-apc-memprotect=no --enable-apc-pthreadmutex=yes --enable-apc-pthreadrwlocks=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 mutexs are supported!
checking whether we should use pthread read/write locking... no
checking whether the target compiler supports builtin atomics... yes
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-rooth5zH7q/APC-3.1.9/libtool --mode=compile cc  -I. -I/root/tmp/pear/APC -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-rooth5zH7q/APC-3.1.9/include -I/root/tmp/pear/pear-build-rooth5zH7q/APC-3.1.9/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-rooth5zH7q/APC-3.1.9/include -I/root/tmp/pear/pear-build-rooth5zH7q/APC-3.1.9/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:
/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:393: 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:454: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:454: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:455: error: 'apc_regex' has no member named 'nreg'
/root/tmp/pear/APC/apc.c:455: 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:487: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:487: error: 'apc_regex' has no member named 'preg'
/root/tmp/pear/APC/apc.c:488: error: 'apc_regex' has no member named 'nreg'
/root/tmp/pear/APC/apc.c:488: error: 'apc_regex' has no member named 'nreg'
make: *** [apc.lo] Error 1
ERROR: `make' failed
The APC.so object is not in /usr/local/lib/php/extensions/no-debug-non-zts-20090626

Any ideas how to fix this?

Thank you.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Try the following:

Code:
yum install pcre-devel
Then try to install APC using pecl in command line:

Code:
pecl install apc
If it still doesn't work, try pcre as well for yum installation:

Code:
yum install pcre
 

cwm1021

Registered
Apr 7, 2007
4
0
151
Try the following:

Code:
yum install pcre-devel
Then try to install APC using pecl in command line:

Code:
pecl install apc
If it still doesn't work, try pcre as well for yum installation:

Code:
yum install pcre
Hi cPanelTristan,

Thanks for reply, I tried what you told, but still unable to install, below is the output info:


Code:
[B]yum install pcre-devel[/B]
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
base                                                                       | 1.1 kB     00:00     
extras                                                                     | 2.1 kB     00:00     
updates                                                                    | 1.9 kB     00:00     
Excluding Packages in global exclude list
Finished
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pcre-devel.i386 0:6.6-6.el5_6.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================
 Package                  Arch               Version                     Repository          Size
==================================================================================================
Installing:
 pcre-devel               i386               6.6-6.el5_6.1               base               181 k

Transaction Summary
==================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 181 k
Is this ok [y/N]: y
Downloading Packages:
pcre-devel-6.6-6.el5_6.1.i386.rpm                                          | 181 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : pcre-devel                                                                 1/1 

Installed:
  pcre-devel.i386 0:6.6-6.el5_6.1

Then:

Code:
[B]pecl install apc[/B]
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
.................................done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Enable internal debugging in APC [no] : no
Enable per request file info about files used from the APC cache [no] : no
Enable spin locks (EXPERIMENTAL) [no] : no
Enable memory protection (EXPERIMENTAL) [no] : no
Enable pthread mutexes (default) [yes] : yes
Enable pthread read/write locks (EXPERIMENTAL) [no] : no
building in /var/tmp/pear-build-root/APC-3.1.9
running: /root/tmp/pear/APC/configure --enable-apc-debug=no --enable-apc-filehits=no --enable-apc-spinlocks=no --enable-apc-memprotect=no --enable-apc-pthreadmutex=yes --enable-apc-pthreadrwlocks=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... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: `/root/tmp/pear/APC/configure --enable-apc-debug=no --enable-apc-filehits=no --enable-apc-spinlocks=no --enable-apc-memprotect=no --enable-apc-pthreadmutex=yes --enable-apc-pthreadrwlocks=no' failed

Then:

Code:
[B]yum install pcre[/B]
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Excluding Packages in global exclude list
Finished
Setting up Install Process
Package pcre-6.6-6.el5_6.1.i386 already installed and latest version
Nothing to do

Any ideas? Thanks in advanced!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
For the new error message:

checking whether the C compiler works... configure: error: cannot run C compiled programs.
This is because /tmp and /var/tmp are likely set to noexec and nosuid:

Code:
mount | grep /tmp
Please try to update pear to have it run from /root/tmp instead for the build directory:

Code:
pear install pear
If that does not work, then please provide the following:

Code:
ls -ld /tmp/pear*
ls -ld /var/tmp/pear*
I would have the pear directory in /tmp and/or /var/tmp symlinked to /root/pear, but I first have to know whether it is called /tmp/pear or /tmp/pear-build-root, since it can differ based on the system.
 

storminternet

Well-Known Member
Nov 2, 2011
460
0
66
cPanel Access Level
Root Administrator

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
If the user doesn't fix pear's installation directory not allowing C compiler to function, then no other pecl or pear installations will work due to the C compiler error occurring (both in WHM and in command line). As such, it would be better to fix the C compiler error occurring rather than compiling from source.
 

chrisbuk

Well-Known Member
PartnerNOC
Dec 7, 2003
398
1
168
Liverpool, United Kingdom
cPanel Access Level
DataCenter Provider
Twitter
Hi

I too have the same problem


There is another method with which you can install APC. Download APC under /usr/src from PECL :: Package :: APC.
Untar it with tar command. Run phpize , make and make install to have it functional.

Steps to install APC



that's it. :)
that dont work for me

phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626


[email protected] [/usr/src/APC-3.1.9]# make
make: *** No targets specified and no makefile found. Stop.
[email protected] [/usr/src/APC-3.1.9]# make install
make: *** No rule to make target `install'. Stop.
[email protected] [/usr/src/APC-3.1.9]#
 

chrisbuk

Well-Known Member
PartnerNOC
Dec 7, 2003
398
1
168
Liverpool, United Kingdom
cPanel Access Level
DataCenter Provider
Twitter
never mind i found after cd to the folder

phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php config=/usr/local/bin/php-config
make
yum install pcre-devel
make install

then in php configugration editor add the .so file reference.
 

texo

Well-Known Member
Mar 28, 2007
151
6
168
cPanel Access Level
Root Administrator
Nube...could someone explain how to do this in a little more detail
As root (using a tool like PUTTY, SSH into your server):

Make a backup of your php.ini file:
Code:
cp /usr/local/lib/php.ini /usr/local/lib/php.ini.bak
Open your php.ini file for editing:
Code:
nano -w /usr/local/lib/php.ini
then CTRL + V until you get to the end of the php.ini file

Copy and paste the following lines (to paste in PUTTY, right-click your mouse)

Code:
extension="apc.so"
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 16M
apc.optimization = 0
apc.num_files_hint = 4096
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl = 0
apc.cache_by_default = 1
apc.filters = ""
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 10M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
;apc.rfc1867 = 0
;apc.rfc1867_prefix = "upload_"
;apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
;apc.rfc1867_freq = 0
apc.localcache = 0
apc.localcache.size = 512
apc.coredump_unmap = 0
apc.stat_ctime = 0
Once you've pasted those lines, save the file

Ctrl + O (or Ctrl + X, enter "y" when prompted to save)

and restart apache:

Code:
/etc/init.d/httpd restart
You might need to finetune some of these settings, particlarly the apc.shm_size value