【问题标题】:Installing apcu via pecl fails on Debian在 Debian 上通过 pecl 安装 apcu 失败
【发布时间】:2014-12-16 01:58:59
【问题描述】:

在 Debian 上,我安装了 php5php5-devphp-pear

然后我尝试安装 apcu,但出现此错误。有什么想法吗?

# pecl install apcu
Failed to download pecl/apcu within preferred state "stable", latest release is version 4.0.7, stability "beta", use "channel://pecl.php.net/apcu-4.0.7" to install
install failed

# pecl install channel://pecl.php.net/apcu-4.0.7
downloading apcu-4.0.7.tgz ...
Starting to download apcu-4.0.7.tgz (118,670 bytes)
..........................done: 118,670 bytes
43 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
Enable full APC compatibility [yes] : yes
Enable internal debugging in APCu [no] : 
building in /tmp/pear/temp/pear-build-root2kAfTA/apcu-4.0.7
running: /tmp/pear/temp/apcu/configure --enable-apc-bc=yes --enable-apcu-debug=no
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/20100525
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 APCu support... yes, shared
checking if APCu should provide APC full compatibility support... yes
checking if APCu should be allowed to use rwlocks... yes
checking if APCu should be built in debug mode... no
checking if APCu should clear on SIGUSR1... no
checking if APCu will use mmap or shm... mmap
checking if APCu should utilize spinlocks before flocks... no
configure: WARNING: APCu has access to native rwlocks
checking for sigaction... yes
checking for union semun... no
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
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... 1572864
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
sh: 1: make: not found
ERROR: `make' failed

编辑: 操作,我没有安装“make”(这很荒谬,如果 pecl 需要它,它应该是一个依赖项,并且在安装上述软件包时已自动安装)

无论如何,现在我得到了这个错误:

In file included from /tmp/pear/temp/apcu/apc.c:44:0:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file 
or directory
compilation terminated.
make: *** [apc.lo] Error 1
ERROR: `make' failed

似乎缺少另一个依赖项。

这些包管理器不应该能够自动安装所有依赖项吗?

有没有比手动安装每一个丢失的部件更简单的方法?

【问题讨论】:

    标签: php debian pear pecl


    【解决方案1】:

    在 Debian 上最简单的方法是使用 apt-get install php5-apcu 您可能需要将特殊的包存储库添加到 /etc/apt/sources.list,以便获取此包:

    deb http://packages.dotdeb.org wheezy-php55 all
    deb-src http://packages.dotdeb.org wheezy-php55 all
    

    我没有安装“make”(这很荒谬,如果 pecl 需要它的话 它应该是一个依赖项,并且已经自动安装,同时 安装上述软件包)

    我赞同这一点。它应该是一个依赖项,您应该在 phpize 期间收到正确的消息。但我不确定是否应该自动安装用于构建或编译的开发工具。


    可能的替代方案:使用名为 Pickle 的工具。

    下载:http://www.pierrejoye.com/pickle/pickle.phar

    php pickle.phar install apcu

    【讨论】:

    • 在另一台服务器上,我按照你的第一种方法,它显然安装了包,但扩展在 PHP 中仍然不可用。我尝试将 'extension="apcu.so"' 添加到 php.ini,但没有改变。然后我将 apcu.so 文件从它的安装位置复制到所有其他 php 扩展真正所在的位置,但仍然没有运气。有什么想法吗?
    • 我想到了两件事:a) 请检查您是否将 APCu 扩展添加到正确的 php.ini 文件中。在 debian 上可能有几个配置,例如一个用于 CLI,一个用于网络服务器,如果您有 FCGI 设置(每个虚拟主机/服务器块一个),可能还有更多。 php -i | grep php.ini, php -m | grep apcu b) 请检查 APCu 扩展的版本是否适合您的 PHP 版本。如果扩展是为其他版本的 PHP 编译的并且不适合,PHP 将打印一条错误消息。但这很不正常,因为 apt-get 获取了它并将其安装到您的版本中。
    • 事实证明,通过 apt 安装的版本(这是我复制到扩展文件夹并使用的版本)已损坏。我可以通过运行php -m 来解决这个问题,并在开头注意到一条错误消息,例如“无法初始化模块”。所以我卸载了那个并使用了通过PECL安装的那个,并且那个可以工作。
    • 啊,好的。我在最后一句话中排除了这一点 :( 如果 apt 的来源是混合的,这可能会发生。PHP 是从一个来源获取的(或预安装在服务器上),并且包是从 packages.dotdeb.org 获取的。无论如何:很高兴你解决了。​​