Windows - PHPDocs unable to install through Pear - php

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

Related

install pear packages from github

I have an old project that relies heavily on PEAR. I need to run the script that installs pear packages daily on a clean virtual machine. In other words, I have to install packages daily since it's a new vm everyday.
Now that PEAR is down and there is no ETA, I can't instal from php.pear.net
My question is how to install pear packages now that pear server is down.
Download the zip you need from https://github.com/pear/ for example: https://github.com/pear/Pager and then pear install package.xml
Unfortunately, this is a terrible solution and it remains to wait until the party gets up.
I tried install package pear Pager in this way:
Download zip from github -> in console I went to the downloaded folder -> I used the command: sudo pear install package.xml
then Pager is installed, but with many package this is very problematic...
I got info from another dev that I have to wait for the website to get up, but it has been going on for so long...

Problems with a PEAR package on a local WAMP 3.0.4 32bit installation

Windows 7 64bit
WAMP 3.0.4 323bit
I have WAMP working and have PEAR installed.
My strange situation starts when I try to install a PEAR package.
php is in C:\wamp32\bin\php\php5.6.19, where WAMP installed it.
I downloaded go-pear.phar from https://pear.php.net/go-pear.phar and put a copy in the php5.6.19 directory.
I then started a command prompt window, changed to the C:\wamp32\bin\php\php5.6.19 directory and entered:
php go-pear.phar
If you want it, I have all the output from that command command prompt window.
Short form - the PEAR installation seemed to complete with errors, the last line was:
The 'pear' command is now at your service at c:\wamp32\bin\php\php5.6.19 \pear.bat
I want to install a package named Text_Highlighter.
At the command prompt I entered:
pear install Text_Highlighter
I got:
Failed to download pear/text_highlighter within preferred state
"stable", latest release is version 0.7.3, stability "beta", use
channel://pear.php.net/text_highlighter-0.7.3" to install install
failed
I then tried:
pear install channel://pear.php.net/text_highlighter-0.7.3
I got (i formatted it as code instead of a quote because using a quote block did not wrap lines and it was impossible to read):
WARNING: "pear/XML_Parser" is deprecated in favor of "pear/XML_Parser2"
WARNING: "pear/Console_Getopt" is deprecated in favor of "pear/Console_GetoptPlu
s"
WARNING: "pear/Console_Getopt" is deprecated in favor of "pear/Console_GetoptPlu
s"
downloading Text_Highlighter-0.7.3.tgz ...
Starting to download Text_Highlighter-0.7.3.tgz (141,773 bytes)
..............................done: 141,773 bytes
downloading PEAR-1.10.1.tgz ...
Starting to download PEAR-1.10.1.tgz (296,139 bytes)
...done: 296,139 bytes
downloading XML_Parser-1.3.6.tgz ...
Starting to download XML_Parser-1.3.6.tgz (13,549 bytes)
...done: 13,549 bytes
downloading Console_Getopt-1.4.1.tgz ...
Starting to download Console_Getopt-1.4.1.tgz (5,672 bytes)
...done: 5,672 bytes
downloading Archive_Tar-1.4.2.tgz ...
Starting to download Archive_Tar-1.4.2.tgz (20,624 bytes)
...done: 20,624 bytes
downloading Structures_Graph-1.1.1.tgz ...
Starting to download Structures_Graph-1.1.1.tgz (12,579 bytes)
...done: 12,579 bytes
downloading XML_Util-1.3.0.tgz ...
Starting to download XML_Util-1.3.0.tgz (17,351 bytes)
...done: 17,351 bytes
install ok: channel://pear.php.net/Console_Getopt-1.4.1
install ok: channel://pear.php.net/Archive_Tar-1.4.2
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.3.0
install ok: channel://pear.php.net/PEAR-1.10.1
install ok: channel://pear.php.net/XML_Parser-1.3.6
install ok: channel://pear.php.net/Text_Highlighter-0.7.3
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
C:\wamp32\bin\php\php5.6.19>
When that completed, I went to look at the directories and this is where it gets strange (at least to me)
The \wamp32\bin\php directory now has both a \php5.6.19 which is the one WAMP installed and it has \php5.6.15!!
The new directory has a \pear directory and that directory has a \Text directory - where it installed the package - \wamp32\bin\php5.6.15\pear\Text
Why did the package installation create a new php directory - \wamp32\bin\php\php5.6.15 when I ran the pear install command in the \wamp32\bin\php\php5.6.19?
It looks like the install command:
pear install channel://pear.php.net/text_highlighter-0.7.3
installed PHP 5.6.15, PEAR, and the Text_Highlight package? Why?
What should I do to get the package installed in the \wamp32\php\php5.6.19\pear
A few days ago, I had done this installation, as I described above, without noticing that there was a new PHP directory.
I even wrote code to use the package and used the package from the new PHP directory, without realizing it.
I then had some trouble with WAMP and reinstalled it. Today I installed PEAR and the package as I described above.
This time I noticed that there was that new PHP directory and that the package was installed there, in the directory \Text
Recap:
WAMP installed PHP in \wamp32\bin\php\php5.6.19 I put the go-pear.phar file in that directory and ran it to install PEAR.
The "install package" created a new directory, \wamp32\php\php5.6.15 with a \pear subdirectory and a \Text subdirectory with the package in it.
In appears to have installed PHP, PEAR, and the package. Not just the package.
I just tried a little experiment -
I copied the \Text directory (the package directory) from \wamp32\php\php5.6.15\pear (the one the package install created) to \wamp32\php\php5.6.19\pear (which was created when I installed PEAR)
I then modified my PHP code to refer to the package files (changed the path in a require statement) in \wamp32\php\php5.6.19\pear\Text and ran it.
It works just fine.
I just downloaded the package file from the page https://pear.php.net/package/Text_Highlighter/download using a link to http://download.pear.php.net/package/Text_Highlighter-0.7.3.tgz
When I unarchived that file I get the same thing as was put in the \pear\Text directory by the package install.
Does this mean that installing a PEAR package is simply a matter of downloading it and putting it in subdirectory of the \pear directory?
It just seems there has to be more to it than that?
Can anyone explain this to me, please?
If you want to see the entire command prompt output from the start of installing PEAR to the end of the package install, let me know and I will edit this and add it.

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

phpunit require_once() error

I recently installed phpunit on my server via the pear installer.
When I go to run a test I get the following error:
PHP Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 44
PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Util/Filter.php' (include_path='.:/usr/bin/php') in /usr/bin/phpunit on line 44
After doing some searching, I tried making some modifications to the include_path in my php.ini file on the server. But that hasn't done a thing.
Any idea what might be causing this?
UPDATE: As of 2013 November and Ubuntu 12.04 these 2 commands should suffice:
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
The following is an older answer.
It's a known problem , although almost a year and a half had passed. Read about it here
The code coverage must be installed in order for phpunit to work properly
What you need to do is covered here:
code coverage installation through PEAR
Basically you have to type (with sudo if you don't have permissions, taken that phpunit is already installed):
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/PHP_CodeCoverage
I had this problem on OS X. Fixed it with the following commands which force all the php dependencies to be reinstalled, which included a couple of packages from other channels that were not already configured:
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --alldeps phpunit/PHPUnit
https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544
and specially this comment for ubuntu 11.04 and may be for some others too
even though i did ths steps as recommended above, i didn't get it to work but after i upgraded pear from 1.9.1 to 1.9.2 it's working perfectly just do this
speshu#speshu-laptop:~$ sudo pear upgrade pear
downloading PEAR-1.9.2.tgz ...
Starting to download PEAR-1.9.2.tgz (295,120 bytes)
.....................................................done: 295,120 bytes
upgrade ok: channel://pear.php.net/PEAR-1.9.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
If it is the first time you are using PEAR, perhaps you have not configured the include path right. Take a look at the appropriate section in the PEAR manual.
https://github.com/sebastianbergmann/php-code-coverage
sb#ubuntu ~ % pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
sb#ubuntu ~ % pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
sb#vmware ~ % pear install phpunit/PHP_CodeCoverage
downloading PHP_CodeCoverage-0.9.0.tgz ...
Starting to download PHP_CodeCoverage-0.9.0.tgz (108,376 bytes)
.........................done: 108,376 bytes
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-0.9.0
(include_path='.:/usr/bin/php')
Are you sure you added it to the include_path?
It might also help if we saw your ini file, and the include_path snippet in it...
I found it!
Looks like PEAR installed PHPUnit in /usr/share/pear. Not sure why but that's where it is. Must be a (mt) thing.
Anyway, I'm all set. Thanks for the help.
This is also what happens if you have an out-of-date or incomplete PHPUnit install. Please be aware that after you set up PEAR, you must add the PHPUnit.de channel in order to get an up-to-date package.
In my case, I solved it by adding /usr/share/php/PEAR to the include_path.
I'm using Ubuntu 10.04.2.
If you have problems with accessing components try another way.
Install pear
sudo apt-get install php-pear
Install phpunit by using pear.
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
Install phpunit/Selenium, but first you need to install curl module
sudo apt-get install php5-curl
pear install phpunit/PHPUnit_Selenium
I was having the same problem. Netbeans was reporting that the phpunit version was too old (which it wasn't). Running the phpunit script directly showed the above messages.
I solved it adding:
include_path=".:/usr/share/php"
To /etc/php5/cli/php.ini
Please NOTE that the php.ini file is the one for php CLI (command) not the php.ini used for apache!
My original problem was I could not get the command line version of php (yum install php or yum install php-cli) to upgrade to => php5.2.7 I was stuck on 5.1 version
I had already compiled php 5.3.3 for use with apache. So I setup a symbolic link from /usr/bin/php (the command line default) to my compiled version in /var/php5/bin/php to get the command line php reporting 5.3.3
Then I refollowed the pear install steps for phpunit
But it still needed the code coverage stuff when I ran phpunit.
So I hunted code coverage down under /var/php5/lib/php/PHP/CodeCoverage and added that to the include path in php.ini
include_path=".:/var/php5/lib/php/"
Make sure to add it to the include path without /PHP because phpunit starts at PHP/ (notice caps) looking for Code Coverage
Failed opening required 'PHP/CodeCoverage/Filter.php'
I had this problem . I was developing a zend framework site. Finally I manage to solve it by removing the zend installation and removing/commenting the include path in bath php.ini files in apache and cli. To develop site with zend we don't need to have zend installed. Insted we can copy the library to our site folder
For me dividing test's in multiple batches helped.
You can solve this issue by redefining the environment variables in PEAR.
This is how I solved the problem and I used Ubuntu 12.10
http://rkrants.blogspot.in/2013/01/installing-phpunitpear-in-ubuntu-1210.html
In short it defines the paths and then reinstalls phpunit
Ubuntu 12.04:
sudo pear channel-discover pear.symfony.com
sudo pear install --alldeps phpunit/PHPUnit
I had the same issue with Windows 8
Similar to the top answer, I needed to start the command line, however make sure to run cmd.exe as administrator. Then the two commands
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

Categories