Estou tendo problemas para me livrar dos meus erros de depsolvimento, e fiquei sozinho para descobrir isso sozinho. Tudo começou quando eu queria atualizar do PHP 5.2 para o PHP 5.3 (Heaven probid), e me disseram que nós temos todos os tipos de confusão de dependências porque temos vários pacotes PHP, e ninguém mais está usando, então se eu quisesse Eu teria que fazer isso sozinho.
Eu consegui descobrir como instalar o PHP 5.3, mas apenas removendo todas as versões anteriores do PHP e fazendo uma nova instalação. Agora o código "my" (de alguém que partiu) está contando com PHPExcel, que depende do php-pecl-zip, que aparentemente não tenho. Veja um pouco do que tentei:
Instalar com PECL
# pecl install zip
No releases available for package "pecl.php.net/zip"
install failed
Tenho certeza de que isso ocorre porque nossas máquinas têm regras muito rígidas sobre com quem podem conversar. Então não consigo acessar o pacote via PECL.
Instale com o 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
Por que ele quer uma versão do PHP 5.1 quando eu tenho 5.3?
Claro, se eu deixar isso ir, ele vomita:
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
E apenas para verificar:
# yum list php
Installed Packages
php.x86_64 5.3.24-7 installed
Podemos contornar isso? Algumas tentativas seguem
# 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
Ignorar quebrado não faz nada
# 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
Excluir o pacote não ajuda
# 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
Podemos instalar uma dependência subjacente?
# 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
Aqui é onde o loop de dependência é iniciado. Você notará que temos repositórios liberados pela EMPRESA que estão em jogo.
# 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
Excluir 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
Não.
Então eu acho que o YUM está em um loop de dependência.
Eu também fiz algumas coisas bobas instalando um novo repositório EPEL, mas depois eu não consegui resolver nenhum espelho, então tive que desinstalá-lo. Eu não tenho certeza se essas foram ações simétricas, também.
A primeira vez que fiz isso, também tive que fazer yum install autoconf
Instale o arquivo baixado com o PEAR
Então eu fui para o link e fiz um download, scp-lo para a minha máquina.
# 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
Então, esses primeiros dois avisos são realmente novos. Nunca os vi antes agora. Talvez seja uma nova pista.
(EDIT: Eu acho que este erro de inicialização é porque eu fui em /etc/php.ini
e descomentado extension=php_zip.dll
. Quando eu comentar essa linha de volta para fora, ele vai embora.)
Mas o zlib está lá:
# 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
EDITAR:
# 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"
Portanto, mesmo que o gerenciador de pacotes diga que é o local do zlib e comecei a compilar a coisa manualmente, ainda não funciona.
Reinstalar o zlib? Parece executar bem
# 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!
EDITAR
Graças a esses caras: link , percebi que precisava instalar o zlib-devel. E apenas por precaução, para remover um dos meus avisos, também fiz 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
EDITAR
Agora esses caras ( link ) dizem
# yum install pcre-devel
que não funciona bem para mim, mas
# yum install COMPANY-pcre-devel
funciona bem
# pear install zip-1.12.4.tgz
same make error.
EDITAR
link
link
# 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! Outra dependência para baixo.
# 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
Sim senhor.
# vi /etc/php.ini
add extension=zip.so