3

I'm having trouble getting rid of my depsolving errors, and I've been left to figure this one out on my own. It all started when I wanted to upgrade from PHP 5.2 to PHP 5.3 (heaven forbid), and I was told that we have all kinds of dependency mess because we have multiple PHP packages, and no one else is using it, so if I wanted it, I'd have to do it myself.

I managed to figure out how to get PHP 5.3 installed, but only by removing all previous versions of PHP and doing a fresh install. Now "my" (someone departed's) code is relying on PHPExcel, which relies on php-pecl-zip, which I apparently don't have. Here's some of what I've tried:

Install with PECL

# pecl install zip   
No releases available for package "pecl.php.net/zip"  
install failed

Pretty sure this is because our machines have very strict rules about who they can talk to. So I can't access the package via PECL.

Install with 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

Why does it want a PHP version 5.1 when I have 5.3?
Of course, if I let it go, it 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

And just to verify:

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

Can we get around it? A few attempts follow

# 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 does nothing

# 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

Excluding the package doesn't help

# 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

Can we install an underlying dependency?

# 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

This is where the dependency loop starts. You'll notice we have COMPANY-codex-released repos that are in play.

# 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

Exclude 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

No.

So I think YUM is in a dependency loop.

I also did some silly stuff installing a new EPEL repo, but then yum couldn't resolve any mirrors, so I had to uninstall it. I'm not sure those were symmetric actions, either.

The first time I did this I also had to do yum install autoconf

Install downloaded file with PEAR
So I went to http://pecl.php.net/package/zip and got a download, scp'd it up to my machine.

# 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

So those first couple of warnings are actually new. Never seen them before just now. Maybe that's a new lead.

(EDIT: I think this startup error is because I went into /etc/php.ini and uncommented extension=php_zip.dll. When I comment that line back out, it goes away.)

But zlib is there:

# 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  

EDIT:

# 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"

So even though the package manager says that's the location of zlib, and I've started compiling the thing by hand, it still doesn't work.

Reinstall zlib? Seems to execute fine

# 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!

EDIT
Thanks to these guys: http://ubuntuforums.org/showthread.php?t=692704 I realized I needed to install zlib-devel instead. And just for good measure, to remove one of my warnings, I also did 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

EDIT
Now these guys (http://www.linuxquestions.org/questions/linux-software-2/install-zip-extension-using-pear-840755/) say

# yum install pcre-devel

which doesn't quite work for me, but

# yum install COMPANY-pcre-devel

works fine

# pear install zip-1.12.4.tgz 

same make error.

EDIT
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

BOOM! Another dependency down.

# 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

Yes sir.

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

1 Answer 1

2
  • Couldn't access the pecl servers from my server, so download tarball from http://pecl.php.net/package/zip and manually put it on server
  • yum install zlib-devel
  • yum install pcre-devel didn't work for me, so I had to go to http://rpm.pbone.net/index.php3/stat/26/dist/55/size/571124/name/pcre-6.6-2.el5_1.7.src.rpm to get the exact RPM version that was listed in my depsolving error.
  • yum install rpm-build
  • scp pcre-6.6-2.el5_1.7.src.rpm to my server
  • 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 installed | grep pcre to see that it worked
  • cd dir/to/manually/uploaded/zip.tgz
  • pear install zip-1.12.4.tgz
  • vi /etc/php.ini
  • add extension=zip.so to php.ini

Full details and all pages referenced are in the description and edits above.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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