Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I install APC:

pecl install apc

I'm getting this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 apache2-prefork-dev : Depends: apache2.2-common (= 2.2.22-1ubuntu1.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@vps29386:/var/www# pecl install apc
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)
.....................................done: 171,591 bytes
55 source files, building
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Enable internal debugging in APC [no] : 
Enable per request file info about files used from the APC cache [no] : 
Enable spin locks (EXPERIMENTAL) [no] : 
Enable memory protection (EXPERIMENTAL) [no] : 
Enable pthread mutexes (default) [no] : 
Enable pthread read/write locks (EXPERIMENTAL) [yes] : 
building in /tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13
running: /tmp/pear/temp/APC/configure --enable-apc-debug=no --enable-apc-filehits=no --enable-apc-spinlocks=no --enable-apc-memprotect=no --enable-apc-pthreadmutex=no --enable-apc-pthreadrwlocks=yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 ISO C89... 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/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
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... no
checking whether we should use pthread read/write locking... yes
pthread rwlocks are supported!
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 whether to include code coverage symbols... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) 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
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/sh /tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc.c -o apc.lo
libtool: compile:  cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
/tmp/pear/temp/APC/apc.c: In function 'apc_search_paths':
/tmp/pear/temp/APC/apc.c:416:20: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
/bin/sh /tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/php_apc.c -o php_apc.lo
libtool: compile:  cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/php_apc.c  -fPIC -DPIC -o .libs/php_apc.o
/bin/sh /tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_cache.c -o apc_cache.lo
libtool: compile:  cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
/bin/sh /tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/libtool --mode=compile cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_compile.c -o apc_compile.lo
libtool: compile:  cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/include -I/tmp/pear/temp/pear-build-rootqMrKzw/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_compile.c  -fPIC -DPIC -o .libs/apc_compile.o
/tmp/pear/temp/APC/apc_compile.c: In function 'my_copy_class_entry':
/tmp/pear/temp/APC/apc_compile.c:755:9: warning: assignment from incompatible pointer type [enabled by default]
/tmp/pear/temp/APC/apc_compile.c: In function 'apc_copy_class_entry_for_execution':
/tmp/pear/temp/APC/apc_compile.c:1956:9: warning: assignment from incompatible pointer type [enabled by default]
/tmp/pear/temp/APC/apc_compile.c: In function 'apc_copy_trait_alias':
/tmp/pear/temp/APC/apc_compile.c:2379:12: error: 'zend_trait_alias' has no member named 'function'
/tmp/pear/temp/APC/apc_compile.c:2380:9: error: 'zend_trait_alias' has no member named 'function'
/tmp/pear/temp/APC/apc_compile.c:2380:9: error: 'zend_trait_alias' has no member named 'function'
/tmp/pear/temp/APC/apc_compile.c: In function 'apc_copy_trait_precedence':
/tmp/pear/temp/APC/apc_compile.c:2416:12: error: 'zend_trait_precedence' has no member named 'function'
/tmp/pear/temp/APC/apc_compile.c:2417:9: error: 'zend_trait_precedence' has no member named 'function'
/tmp/pear/temp/APC/apc_compile.c:2417:9: error: 'zend_trait_precedence' has no member named 'function'
make: *** [apc_compile.lo] Error 1
ERROR: `make' failed

I've installed php5-gd and libpcre3-dev. But when I try to install apache2-prefork-dev, I get this error:

    Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 apache2-prefork-dev : Depends: apache2.2-common (= 2.2.22-1ubuntu1.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages

What can it be due to? Any idea?

share|improve this question
    
Have you tried installing Apache common? –  Drew Khoury Aug 23 '13 at 12:12
    
APC is currently not compatible with PHP 5.5. A native opcode cache was added into it. –  Kdecherf Aug 23 '13 at 12:15
    
All right Kdecherf. What should I do so? Enable opcode? Or is it enabled by default? Good option to use opcode? –  Manolo Salsas Aug 23 '13 at 12:19
    
@ManoloSalsas yes, opcache seems to be enabled by default php.net/manual/en/opcache.configuration.php –  Kdecherf Aug 23 '13 at 13:31
    
Yeah! Seems to work right! Thanks –  Manolo Salsas Aug 23 '13 at 16:29
add comment

2 Answers

up vote 4 down vote accepted

PHP 5.5 has built-in opcode optimizer OPcache making APC obsolete.

According to APC changelogs, PHP up to only 5.4 is supported.

Please use OPcache with PHP 5.5+ http://www.php.net/manual/en/opcache.installation.php

share|improve this answer
add comment

From your post it seems that the packages are broken. Switch to the root user. If you are running ubuntu run apt-get update.

If you are running centos run yum update

This should resolve the broken package problem. You can then install APC.

share|improve this answer
    
After apt-get update and apt-get upgrade I get: "0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded". Nothing changes. –  Manolo Salsas Aug 23 '13 at 12:20
    
apache2.2-common not being installed is the problem. See the answers here and here –  sridhar pandurangiah Aug 23 '13 at 13:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.