微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

yum – 解析php-pecl-zip

我无法摆脱我的贬低错误,而且我已经被自己想出来了.这一切都始于我想从PHP 5.2升级PHP 5.3(天堂禁止),我被告知我们有各种各样的依赖混乱,因为我们有多个PHP包,没有其他人使用它,所以如果我想要它,我必须自己做.

我设法弄清楚如何安装PHP 5.3,但只能删除所有以前版本的PHP并进行全新安装.现在“我的”(有人离开)的代码依赖于PHPExcel,它依赖于PHP-pecl-zip,我显然没有.这是我尝试过的一些内容

使用PECL安装

# pecl install zip   
No releases available for package "pecl.PHP.net/zip"  
install Failed

很确定这是因为我们的机器对于他们可以与谁交谈有非常严格的规定.所以我无法通过PECL访问包.

使用YUM安装

# yum install PHP-pecl-zip
Dependencies Resolved

================================================================================
 Package             Arch          Version                 Repository      Size
================================================================================
Installing:
 PHP-pecl-zip        x86_64        1.8.10-2.el5            epel            47 k
Installing for dependencies:
 PHP-common          x86_64        5.1.6-24.el5_4.5        updates        152 k

我有5.3时,为什么它需要PHP版本5.1?
当然,如果我放手,它就是barfs:

Transaction Check Error:
  file /etc/PHP.ini from install of PHP-common-5.1.6-24.el5_4.5.x86_64 conflicts with file from package PHP-5.3.24-7.x86_64

只是为了验证:

# yum list PHP
Installed Packages
PHP.x86_64                          5.3.24-7                           installed

我们可以解决它吗?接下来几次尝试

# yum install PHP-pecl-zip --skip-broken
Transaction Check Error:
  file /etc/PHP.ini from install of PHP-common-5.1.6-24.el5_4.5.x86_64 conflicts with file from package PHP-5.3.24-7.x86_64

Skip broken什么都不做

# yum install PHP-pecl-zip --skip-broken --exclude=PHP-common
PHP-pecl-zip-1.8.10-2.el5.x86_64 from epel has depsolving problems
  --> Missing Dependency: PHP-api = 20041225 is needed by package PHP-pecl-zip-1.8.10-2.el5.x86_64 (epel)
Packages skipped because of dependency problems:
    PHP-pecl-zip-1.8.10-2.el5.x86_64 from epel

包括包没有帮助

# yum install PHP-pecl-zip --skip-broken --exclude=PHP-common --exclude=PHP-api
PHP-pecl-zip-1.8.10-2.el5.x86_64 from epel has depsolving problems
  --> Missing Dependency: PHP-api = 20041225 is needed by package PHP-pecl-zip-1.8.10-2.el5.x86_64 (epel)

Packages skipped because of dependency problems:
    PHP-pecl-zip-1.8.10-2.el5.x86_64 from epel

我们可以安装底层依赖吗?

# yum install PHP-api
Package PHP-common is obsoleted by lift-PHP, trying to install lift-PHP-5.3.24-10.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package lift-PHP.x86_64 0:5.3.24-10 set to be updated
--> Processing Conflict: lift-PHP conflicts PHP
--> Finished Dependency Resolution
lift-PHP-5.3.24-10.x86_64 from COMPANY-codex-released has depsolving problems
  --> lift-PHP conflicts with PHP
Error: lift-PHP conflicts with PHP

这是依赖循环开始的地方.您会注意到我们有正在运行的COMPANY-codex发布的回购.

# yum install PHP-api --skip-broken
Package PHP-common is obsoleted by lift-PHP, trying to install lift-PHP-5.3.24-10.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package lift-PHP.x86_64 0:5.3.24-10 set to be updated
--> Processing Conflict: lift-PHP conflicts PHP
--> Finished Dependency Resolution
lift-PHP-5.3.24-10.x86_64 from COMPANY-codex-released has depsolving problems
  --> lift-PHP conflicts with PHP

Packages skipped because of dependency problems:
    lift-PHP-5.3.24-10.x86_64 from COMPANY-codex-released

排除lift-PHP

# yum install PHP-api --exclude=lift-PHP
================================================================================
 Package           Arch          Version                   Repository      Size
================================================================================
Installing:
 PHP-common        x86_64        5.1.6-24.el5_4.5          updates        152 k

没有.

所以我认为YUM处于依赖循环中.

我也做了一些愚蠢的事情,安装了一个新的EPEL repo,但是yum无法解析任何镜像,所以我不得不卸载它.我也不确定那些是对称行为.

我第一次这样做,我也不得不做yum install autoconf

使用PEAR安装下载的文件
所以我去了http://pecl.php.net/package/zip并下载了,把它写到了我的机器上.

# pear install -O /home/produser/zip-1.12.4.tgz 
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/PHP/20090626/PHP_zip.dll' - /usr/lib/PHP/20090626/PHP_zip.dll: cannot open shared object file: No such file or directory in UnkNown on line 0
96 source files, building
running: PHPize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
building in /var/tmp/pear-build-rootZ3jpba/zip-1.12.4
running: /var/tmp/zip/configure
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/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... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for zip archive read/writesupport... yes, shared
checking for the location of libz... no
checking pcre install prefix... no
checking libzip... no
checking for the location of zlib... configure: error: zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/var/tmp/zip/configure' Failed

所以前几个警告实际上是新的.刚才没见过他们.也许这是一个新的领导.

(编辑:我认为这个启动错误是因为我进入了/etc/PHP.ini并且没有注释extension = PHP_zip.dll.当我评论该行后退时,它会消失.)

但是zlib在那里:

# yum install zlib
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Excluding Packages in global exclude list
Finished
Excluding Packages from CentOS-5 - Plus
Finished
Setting up Install Process
Package zlib-1.2.3-3.x86_64 already installed and latest version
nothing to do  

编辑:

# rpm -ql zlib
/usr/lib64/libz.so.1
/usr/lib64/libz.so.1.2.3
/usr/share/doc/zlib-1.2.3
/usr/share/doc/zlib-1.2.3/README

# tar xzf zip-1.12.4.tgz
# cd zip-1.12.4
# PHPize
# ./configure --with-zlib-dir=/usr/lib64/libz.so.1
configure: error: Can not find zlib headers under "/usr/lib64/libz.so.1"
# ./configure --with-zlib-dir=/usr/lib64/libz.so.1.2.3
configure: error: Can not find zlib headers under "/usr/lib64/libz.so.1.2.3"
# ./configure --with-zlib-dir=/usr/share/doc/zlib-1.2.3 #not that i expect this one to work
configure: error: Can not find zlib headers under "/usr/share/doc/zlib-1.2.3"
# ./configure --with-zlib-dir=/usr/share/doc/zlib-1.2.3/README #not that i expect this one to work
configure: error: Can not find zlib headers under "/usr/share/doc/zlib-1.2.3/README"

因此,即使包管理器说这是zlib的位置,并且我已经开始手工编译,但它仍然不起作用.

重新安装zlib?似乎执行得很好

# yum reinstall zlib
Downloading Packages:
zlib-1.2.3-3.x86_64.rpm                                  |  51 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing        : zlib                                                     1/2 
  Installing     : zlib                                                     1/2 

Removed:
  zlib.x86_64 0:1.2.3-3                                                         

Installed:
  zlib.x86_64 0:1.2.3-3                                                         

Complete!

编辑
感谢这些家伙:http://ubuntuforums.org/showthread.php?t=692704我意识到我需要安装zlib-devel.只是为了好的措施,删除我的一个警告,我也做了re2c.

# yum install zlib-devel
Success

# pear install zip-1.12.4.tgz 
make: *** [PHP_zip.lo] Error 1
ERROR: `make' Failed

# yum install re2c
Success

# pear install zip-1.12.4.tgz 
...  
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /var/tmp/pear-build-root4xHrWH/zip-1.12.4/libtool --mode=compile cc  -I. -I/var/tmp/zip -DPHP_ATOM_INC -I/var/tmp/pear-build-root4xHrWH/zip-1.12.4/include -I/var/tmp/pear-build-root4xHrWH/zip-1.12.4/main -I/var/tmp/zip -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 -I/var/tmp/zip/lib  -DHAVE_CONfig_H  -g -O2   -c /var/tmp/zip/PHP_zip.c -o PHP_zip.lo
mkdir .libs
 cc -I. -I/var/tmp/zip -DPHP_ATOM_INC -I/var/tmp/pear-build-root4xHrWH/zip-1.12.4/include -I/var/tmp/pear-build-root4xHrWH/zip-1.12.4/main -I/var/tmp/zip -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 -I/var/tmp/zip/lib -DHAVE_CONfig_H -g -O2 -c /var/tmp/zip/PHP_zip.c  -fPIC -DPIC -o .libs/PHP_zip.o
In file included from /var/tmp/zip/PHP_zip.c:30:
/usr/include/PHP/ext/pcre/PHP_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /var/tmp/zip/PHP_zip.c:30:
/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’
/var/tmp/zip/PHP_zip.c: In function ‘PHP_zip_pcre’:
/var/tmp/zip/PHP_zip.c:672: error: ‘pcre’ undeclared (first use in this function)
/var/tmp/zip/PHP_zip.c:672: error: (Each undeclared identifier is reported only once
/var/tmp/zip/PHP_zip.c:672: error: for each function it appears in.)
/var/tmp/zip/PHP_zip.c:672: error: ‘re’ undeclared (first use in this function)
/var/tmp/zip/PHP_zip.c:673: error: ‘pcre_extra’ undeclared (first use in this function)
make: *** [PHP_zip.lo] Error 1
ERROR: `make' Failed

编辑
在这些家伙(http://www.linuxquestions.org/questions/linux-software-2/install-zip-extension-using-pear-840755/)说

# yum install pcre-devel

这不适合我,但是

# yum install COMPANY-pcre-devel

工作良好

# pear install zip-1.12.4.tgz 

同样会犯错误.

编辑
http://www.linuxquestions.org/questions/red-hat-31/rpm-error-cannot-create-sourcedir-165733/
http://rpm.pbone.net/index.php3/stat/26/dist/55/size/571124/name/pcre-6.6-2.el5_1.7.src.rpm

# yum install rpm-build
# rpmbuild --rebuild pcre-6.6-2.el5_1.7.src.rpm  # manually downloaded this exact version of the rpm
TONS of output, but the tests all passed, so it seems to have worked...
# cd /usr/src/redhat/RPMS/x86_64
# rpm -ivh pcre-devel-6.6-2.7.x86_64.rpm 
# yum list installed | grep pcre
pcre.x86_64                                  6.6-2.7                   installed
pcre-devel.x86_64

                        6.6-2.7                   installed

繁荣!另一个依赖下来.

# cd dir/to/manually/uploaded/zip.tgz
# pear install zip-1.12.4.tgz 

Build process completed successfully
Installing '/usr/lib/PHP/20090626/zip.so'
install ok: channel://pecl.PHP.net/zip-1.12.4
configuration option "PHP_ini" is not set to PHP.ini location
You should add "extension=zip.so" to PHP.ini

是的先生.

# vi /etc/PHP.ini
add extension=zip.so

解决方法:

>无法从我的服务器访问pecl服务器,因此从http://pecl.php.net/package/zip下载tarball并手动将其放在服务器上
> yum install zlib-devel
> yum install pcre-devel对我不起作用,所以我不得不去
http://rpm.pbone.net/index.php3/stat/26/dist/55/size/571124/name/pcre-6.6-2.el5_1.7.src.rpm
获取我的depsolving错误中列出的确切RPM版本.
> yum install rpm-build
> scp pcre-6.6-2.el5_1.7.src.rpm到我的服务器
> rpmbuild –rebuild pcre-6.6-2.el5_1.7.src.rpm
> cd /usr/src / redhat / RPMS / x86_64
> rpm -ivh pcre-devel-6.6-2.7.x86_64.rpm
>安装了yum list | grep pcre看到它有效
> cd dir / to / manual / uploaded / zip.tgz
> pear install zip-1.12.4.tgz
> vi /etc/PHP.ini
>将extension = zip.so添加PHP.ini

完整的详细信息和所有引用的页面都在上面的描述和编辑中.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐