PEAR package install fails

本小妞迷上赌 提交于 2019-12-03 06:31:33

The only way I found to get pear working when using Xamp is do delete the folder and reinstall it from scratch. The pear client (for a long time the very very broken 1.9.2 version) doesn't work properly even when in the excepted location but there is no sane way to fix it when you install xamp somewhere else as the path is set in way to many files.

Follow the guide on http://pear.php.net/manual/en/installation.getting.php.

Download http://pear.php.net/go-pear.phar, execute it, select system wide install and adapt all the pathes to your location.

Once that is working and pear version reports 1.9.4 use

pear config-set auto_discover 1
pear install --force --alldeps pear.phpqatools.org/phpqatools

to "fix" anything the old installation left over.


Just using that version of pear should fix all your Package and channel troubles too.

It it, for some reason, doesn't use

pear channel-discover $everyChannelThatDoesNotWork
pear channel-update $thatChannel

for everything that gets reported as a problem.

If, like it was for me, running all the pear config-set commands still result in this error:

failed to mkdir C:\php\pear\tests\PHP_CodeSniffer\CodeSniffer\Core\File

then there is a simple solution which took me a while to figure out:

Run your terminal as administrator

Really, thats the solution. Then like others said: goto c:\xampp\php in your terminal and type following commands:

pear config-set doc_dir C:\xampp\php\pear\docs
pear config-set cfg_dir C:\xampp\php\pear\cfg
pear config-set data_dir C:\xampp\php\pear\data
pear config-set man_dir C:\xampp\php\local\man
pear config-set test_dir C:\xampp\php\pear\tests
pear config-set www_dir C:\xampp\php\pear\www

pear install PHP_CodeSniffer

Try to correct the config paths with following commands:

pear config-show

pear config-create / C:\xampp\php\pear.ini

pear -c c:\xampp\php\pear.ini config-set doc_dir c:\xampp\php\pear\docs
pear -c c:\xampp\php\pear.ini config-set bin_dir c:\xampp\php
pear -c c:\xampp\php\pear.ini config-set ext_dir c:\xampp\php\ext
pear -c c:\xampp\php\pear.ini config-set php_dir c:\xampp\php\pear
pear -c c:\xampp\php\pear.ini config-set cache_dir c:\xampp\php\cache
pear -c c:\xampp\php\pear.ini config-set cfg_dir c:\xampp\php\cfg
pear -c c:\xampp\php\pear.ini config-set data_dir c:\xampp\php\data
pear -c c:\xampp\php\pear.ini config-set download_dir c:\xampp\php\download
pear -c c:\xampp\php\pear.ini config-set php_bin c:\xampp\php\php.exe
pear -c c:\xampp\php\pear.ini config-set temp_dir c:\xampp\php\tmp
pear -c c:\xampp\php\pear.ini config-set test_dir c:\xampp\php\pear\tests
pear -c c:\xampp\php\pear.ini config-set www_dir c:\xampp\php\pear\www

pear -c c:\xampp\php\pear.ini config-show

Every pear command should use -c c:\xampp\php\pear.ini parameter, for example:

pear -c c:\xampp\php\pear.ini config-set auto_discover 1
pear -c c:\xampp\php\pear.ini install pear.phpqatools.org/phpqatools

No need to delete the PEAR cache manually

pear clear-cache 

clears the pear cache without having to go searching for the cache manually.

This solved the response I was getting when trying to download packages from the Structures channel which was

 no release for package ....

which indicated to me that pear had no new release for that particular package which had already been recorded as being on my system, although not successfully installed.

Also changing the preferred state from stable to devel using

pear config-set preferred_state devel

allowed installation of all the packages I required, most of which are either devel or alpha

Hope this helps someone from wasting nearly a day that this has cost me getting to the bottom of why I was getting the "No releases" response.

Pear isn't configured properly. I remember XAMPP's install of pear not working out of the box.

See here for guidance on how to set the required variables properly. Find the ones that are set to a default value, like C:\php\<something> and change them to folders in XAMPP's pear/php installation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!