如何安装Pecl Phar? (得到错误)

时间:2015-07-17 00:11:30

标签: php centos pecl phar

On 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

所以我发现这个非常useful post,它向我展示了如何手动下载包,放在正确的位置。但是在运行./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的任何帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

回答我自己的问题。事实证明,PHAR不是用PHP编译的,为了让它工作,我必须在启用PHAR包的情况下重新编译php。