安装 Pecl Phar 包时出现问题-make 失败

安装 Pecl Phar 包时出现问题-make 失败

在 Centos 6 上,php 5.5

我正在尝试使用 PECL 安装 PHAR 包。安装过程中出现“make failed”错误:

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-rootZdozvf/phar-2.0.0/libtool --mode=compile cc  -I. -I/root/tmp/pear/phar -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-rootZdozvf/phar-2.0.0/include -I/root/tmp/pear/pear-build-rootZdozvf/phar-2.0.0/main -I/root/tmp/pear/phar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /root/tmp/pear/phar/util.c -o util.lo
mkdir .libs
 cc -I. -I/root/tmp/pear/phar -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-rootZdozvf/phar-2.0.0/include -I/root/tmp/pear/pear-build-rootZdozvf/phar-2.0.0/main -I/root/tmp/pear/phar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/phar/util.c  -fPIC -DPIC -o .libs/util.o
/root/tmp/pear/phar/util.c: In function ‘phar_mount_entry’:
/root/tmp/pear/phar/util.c:205: error: ‘struct _php_core_globals’ has no member named ‘safe_mode’
/root/tmp/pear/phar/util.c:205: error: ‘CHECKUID_CHECK_FILE_AND_DIR’ undeclared (first use in this function)
/root/tmp/pear/phar/util.c:205: error: (Each undeclared identifier is reported only once
/root/tmp/pear/phar/util.c:205: error: for each function it appears in.)
/root/tmp/pear/phar/util.c: In function ‘phar_find_in_include_path’:
/root/tmp/pear/phar/util.c:274: warning: assignment discards qualifiers from pointer target type
/root/tmp/pear/phar/util.c: In function ‘phar_open_archive_fp’:
/root/tmp/pear/phar/util.c:854: error: ‘struct _php_core_globals’ has no member named ‘safe_mode’
/root/tmp/pear/phar/util.c:854: error: ‘CHECKUID_ALLOW_ONLY_FILE’ undeclared (first use in this function)
/root/tmp/pear/phar/util.c: In function ‘phar_add_virtual_dirs’:
/root/tmp/pear/phar/util.c:2218: warning: assignment discards qualifiers from pointer target type
make: *** [util.lo] Error 1
ERROR: `make' failed

我不知道为什么,但是我去了 PECL 并看到 PHAR 包有一些依赖项,我尝试安装列出的第一个依赖项 BZ2,但随后出现另一个错误:

Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

所以我发现这非常有用的帖子,它向我展示了如何手动下载软件包,并放在正确的位置。但在运行 ./configure 后,我只收到一条消息,告诉我重新安装 BZ2。

因此我发现我可以运行pecl install --alldeps phar来安装所有依赖项。我这样做了,现在出现以下错误:

 cc -I. -I/root/tmp/pear/hash -DPHP_ATOM_INC -I/root/tmp/pear/pear-build-rootm2aHqA/hash-1.5/include -I/root/tmp/pear/pear-build-rootm2aHqA/hash-1.5/main -I/root/tmp/pear/hash -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/hash/hash.c  -fPIC -DPIC -o .libs/hash.o
/root/tmp/pear/hash/hash.c:785: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:792: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:799: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:807: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:815: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:822: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:828: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:835: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:842: error: duplicate ‘static’
/root/tmp/pear/hash/hash.c:848: error: duplicate ‘static’
make: *** [hash.lo] Error 1
ERROR: `make' failed

我将非常感激任何有关安装 phar 的帮助。谢谢!

注意:我最初在 stackoverflow 上发布了此信息,但认为 severfault 更合适。

答案1

http://php.net/manual/en/phar.installation.php

The Phar extension is built into PHP as of PHP version 5.3.0. Phar may be installed via the PECL extension with previous PHP versions, and the » Phar PECL page contains further information and history.

看起来您的 PHP 未使用 Phar 支持进行编译,您需要重新编译它才能使 Phar 正常工作。

相关内容