Install json extension for php with pecl - php

I try to install json extension for php. Using pecl I get the following error:
# pecl install json
downloading json-1.2.1.tgz ...
Starting to download json-1.2.1.tgz (-1 bytes)
....done: 3,585 bytes
Could not get contents of package "/tmp/tmpSdh32B/json-1.2.1.tgz". Invalid tgz file.
Download of "pecl/json" succeeded, but it is not a valid package archive
Error: cannot download "pear/json"
I crawl the web for possible solutions, but without success. Thanks in advance for any pointer.
Best, Andrej

The pecl site was down. After the server was up again, it worked.

Related

Windows - PHPDocs unable to install through Pear

When running the two commands to install phpdocs:
pear channel-discover pear.phpdoc.org pear install
phpdoc/phpDocumentor
I get this error below saying I am unable to unpack a tgz file below.
C:\wamp\bin\php\php5.5.12\pear>pear channel-discover pear.phpdoc.org
C:\wamp\bin\php\php5.5.12\pear>pear install phpdoc/phpDocumentor
downloading phpDocumentor-2.8.2.tgz ...
Starting to download phpDocumentor-2.8.2.tgz (16,246,834 bytes)
................................................................................
................................................................................
................................................................................
..........................done: 16,246,834 bytes
ERROR: unable to unpack C:\Users\me\AppData\Local\Temp\pear\download\p
hpDocumentor-2.8.2.tgz
Faced the same problem, turns out package for 2.8.2 has issues, because
pear install phpdoc/PhpDocumentor-2.8.1 worked just fine
It looks like the PEAR installer was unable to uncompress the downloaded .tgz for some reason, perhaps the zlib extension wasn't compiled in, for example.
As a work-around, you can specify that PEAR should request the uncompressed package file instead:
pear install --nocompress phpdoc/phpDocumentor
I tried #kguest answer ->
pear install --nocompress phpdoc/phpDocumentor
with no luck. So I tried "upgrading"
pear upgrade C:\Users\xxxxx\AppData\Local\Temp\pear\download\phpDocumentor-2.8.2.tar
Again, with no luck. Then I build my own solution:
1) Extract the files from the PEAR temp directory:
C:\Users\xxxxx\AppData\Local\Temp\pear\download\phpDocumentor-2.8.2.tar
2) Repack the recently extracted files as TAR (I used 7zip).
3) Reattempt the upgrade but from the newly created TAR:
C:\temp\phpDocumentor.tar
And only THEN it worked.
My solution for phpDocumentor 2.8.5 was
Download the tarball archive from
https://github.com/phpDocumentor/phpDocumentor2/releases
Uncompress the archive phpDocumentor-2.8.5.tgz manulay (e.g. with 7zip) You will get the phpDocumentor-2.8.5.tar, uncompress it too and you will get the folder phpDocumentor-2.8.5 and the file package.xml
Edit the archive package.xml and change the text template:init to template_init (line 2036) in fact it is a path (Info source: https://github.com/phpDocumentor/phpDocumentor2/issues/1608)
Compress the folder phpDocumentor-2.8.5 and the file package.xml (e.g. phpdoc285.tar)
Install the archive phpdoc285.tar
pear install --nocompress phpdoc285.tar
After a few hours of trying other people's solutions I've finally got it working phpDocumentor 2.9.0
You can download it from:
https://github.com/phpDocumentor/phpDocumentor2/releases
then use pear install "filepath\phpDocumentor-2.9.0.tgz"
This issue is especially on windows os, to avoid the error :
ERROR: unable to unpack ...
install 7-zip before you launch the phpdoc command

PECL install failed opcache

I am having trouble installing zendopcache. When I am running
pecl install zendopcache-7.0.3
I am getting the following:
downloading zendopcache-7.0.3.tgz ...
Starting to download zendopcache-7.0.3.tgz (Unknown size)
....done: 3,582 bytes
Could not get contents of package "/tmp/pear/download/zendopcache-7.0.3.tgz". Invalid tgz file.
Download of "pecl/zendopcache" succeeded, but it is not a valid package archive
Error: cannot download "pecl/zendopcache"
Download failed
install failed
I have looked around for similar issues and I found some suggestion about adding -Z to the install command. This seems to only change the name of the requested file from zendopcache-7.0.3.tgz to zendopcache-7.0.3.tar but the output remains the same (yes, it still complains that a .tar is not a valid .tgz).
I am running Debian 7 Wheezy with PHP 5.4.4-14+deb7u14
I have seen similar issues reported but none had working answers.
Can someone help?
Thanks!
seems there was a temporary issue with the pecl & pear servers. nevermind

Installing Predis Error : Download of "nrk/Predis" succeeded, but it is not a valid package archive

I've a new EC2 instance with PHP 5.5.4 and I am trying to install Predis from Pear.
Every time I try to install Predis from pear I keep having the following error.
Anyone has an idea on why is this happening? I googled lots for a solution and I cant find an answer
root#ip-xxx-xx-xx-xxx:/etc/nginx# pear install nrk/Predis
downloading Predis-0.8.4.tgz ...
Starting to download Predis-0.8.4.tgz (177,785 bytes)
.....................................done: 177,785 bytes
Parsing of package.xml from file "/tmp/pear/temp/pearxTtEHW/package.xml" failed
Download of "nrk/Predis" succeeded, but it is not a valid package archive
Error: cannot download "nrk/Predis"
Download failed
install failed
PHP 5.5 changed the way unpack works (http://php.net/manual/en/migration55.incompatible.php) so some PEAR or PECL packages are no longer compatible. You can install the package manually. I think it was also fixed in the pear repository, but I'm not sure. It has not been released though.
Seems that Pear can't install from tgz archive.
You have to explicitly request uncompressed files when downloading with -Z, --nocompress option.
So, try sudo pear install -Z package
The best solution for this is to upgrade PEAR's Archive package, which the pear installer uses, and after that you won't need to explicitly request uncompressed files when installing or upgrading existing packages.
$ sudo pear upgrade -Z Archive_Tar

Installing test-helpers extension for PHP on Windows fails

Trying to install phpunit test-helpers ( https://github.com/sebastianbergmann/php-test-helpers )
C:\>pecl install phpunit/test_helpers
downloading test_helpers-1.1.0.tgz ...
Starting to download test_helpers-1.1.0.tgz (10,370 bytes)
.....done: 10,370 bytes
4 source files, building
WARNING: php_bin C:\wamp\bin\php\php5.3.8\php.exe appears to have a suffix \php5.3.8\php.exe, but config variable php_suffix does not match
ERROR: The DSP test_helpers.dsp does not exist.
Using "pecl config-set php_suffix .exe" did not change anything. Unfortunately no recent precompiled DLL's are available to try setting them up manually.
Seems like it's an issue with the test-helpers distribution package.
See the issue and comments: https://github.com/sebastianbergmann/php-test-helpers/issues/6#issuecomment-3654335
If anyone knows how to fix it, it would be great! :)
Note: the Test-Helper extension is superseded by https://github.com/krakjoe/uopz

How to add Solr PECL extension into lampp (xampp) stack

Is it possible to add PECL extensions into a lampp stack? If so, how can it be done?
I am specifically interested in http://www.php.net/manual/en/book.solr.php extension.
EDIT: when installing this extension using:
/opt/lampp/bin/pecl install -f solr
everything seams to go as it should except at the end:
checking for cURL support... yes, shared
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
ERROR: `/tmp/pear/temp/solr/configure --enable-solr=yes --enable-solr-debug=no --with-curl=/opt/lampp/bin --with-libxml-dir=/usr' failed
From what I understand this should mean that it simply needs to find the correct curl location which I specify in the install when it asks as 'opt/lampp/bin'
Does this mean that it can't be done without recompiling php using a different curl package? Is this even possible with a lampp stack or do I have to now build my own?
Any ideas?
see PHP: Installation of PECL extensions.
Also take a look at the requirements of the SOLR extension module: http://docs.php.net/solr.requirements

Categories