I'm trying to install PhpDocumentor 2, and after following the steps for the installation through PEAR, I get the following message:
PEAR_Config::writeConfigFile fopen('C:\Windows\pear.ini','w') failed
(fopen(C:\Windows\pear.ini): failed to open stream: Permission denied)
So I checked the pear configuarion: $ pear config-show and see that things are all over the place. Any idea on how to correct this?
Also, the pear.ini file is nowhere to be found.
You cannot fix the pear.ini-in-c:\windows problem unfortunately.
A solution is to run the terminal as administrator, and run the pear install command in it.
If you want to modify the locations, use pear config-set key value.
Related
I have problems with pecl (ubuntu 20 / xampp 8.0.1), when trying to install something I get the following message:
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading apcu-5.1.19.tgz ...
Starting to download apcu-5.1.19.tgz (96,583 bytes)
.....................done: 96,583 bytes
ERROR: failed to mkdir /opt/lampp/lib/php/test/apcu/tests
When i try the suggested channel update command I get:
could not create lock file
When trying to do pecl upgrade-all I get
pear.php.net is using a unsupported protocol - This should never happen.
Unfortunately I couldn't find anything helpful yet. I'd really appreciate any suggestions how to solve this problem.
You do not have the permissions: You must run a command like this:
sudo pecl channel-update pecl.php.net
I've just installed PEAR into WAMP attempting to follow this article. It all seems to have gone okay but when I type "pear upgrade" into the command prompt I get this error:
ERROR: failed to mkdir c:\php\pear\docs\Archive_Tar\docs
It is looking on the wrong drive (and missing a subdirectory in that path by the looks of it). It should be looking for D:\php\php5.3.13\pear\docs\Archive_Tar\docs
When specifying installation directories I chose ones on the D:\ and thats where the folder structure is, the include_path in both php.ini locations have also been updated. I've also reset the WAMP server after making the changes.
How do I set it to look / install the package in the right place?
My advice is to remove your complete PEAR installation and install from scratch. It'll save you time and sweat. If you have the time and patience, you can fix PEAR parameters with the config-* subcommands:
C:\>pear
Commands:
[...]
config-create Create a Default configuration file
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
Start with pear config-show to inspect current values and see if you can spot invalid ones.
Running:
MAMP 2.0.5
PHP 5.3.6 (bundled with MAMP)
Mac OS X Lion 10.7.2
My goal is to get the Codeception testing framework to work and use within my MAMP project. I'm following the instructions here on how to install it.
Pear is installed and working fine. I am able to get Codeception installed with these commands:
$ pear channel-discover codeception.com/pear
$ pear install codeception/Codeception
Once installed when I try to run the codecept commands I get the following error:
Warning: require_once(Codeception/autoload.php): failed to open stream: No such file or directory in /usr/bin/codecept on line 12
Fatal error: require_once(): Failed opening required 'Codeception/autoload.php' (include_path='.:') in /usr/bin/codecept on line 12
I think that the issue is caused by either:
A conflict between MAMP's PHP installation in the one bundled with OS X
An issue with the include_path in my php.ini or somewhere else
Also of interest
When I run the $ phpunit command from inside my project folder I get -bash: phpunit: command not found but if I run it as $ /Applications/MAMP/bin/php/php5.3.6/bin/phpu
nit it works just fine.
I would expect there to be a codecept file in /Applications/MAMP/bin/php/php5.3.6/bin/ but there isn't - there is however a Codeception folder in /Applications/MAMP/bin/php/php5.3.6/lib/php
I've tried a few different ways to install it, and I guess one of the ways installed Codeception in Lion's copy of php (as opposed to MAMP's) - so I do have a codecept file in /usr/bin/ as well as the Codeception folder in /usr/lib/php/pear/
For reference:
PHP lives here: /Applications/MAMP/bin/php/php5.3.6/bin/php
Pear lives here: /Applications/MAMP/bin/php/php5.3.6/bin/pear
PHPUnit lives here: /Applications/MAMP/bin/php/php5.3.6/bin/phpunit
Any Help? Suggestions?
Thanks to Davert's help - I was able to confirm that this is a conflict with MAMP's copy of PHP and Lion's built-in copy of PHP. To solve the issue I created a new php.ini file in /etc that was a duplicate of php.ini.default and changed the include_path to /Applications/MAMP/bin/php/php5.3.6/lib/php
I think the problem is: your PEAR command was executed from bundled PHP. So your primary MAMP PHP libraries in (/Applications/MAMP/bin/php/php5.3.6/bin/pear) were not updated. I suggest you should find the second PEAR were the Codeception was exctually stored. And add path to it into 'include_path' in php.ini.
Yes, PEAR is quite buggy. In next releases a Composer installator will be added.
Also, you can try to use Phar executable.
In this case a Codeception should be executed with:
php codecept.phar
One solution that worked for me was to edit /Applications/MAMP/bin/php5.3/bin/codecept and replace /usr/bin/php at the first line by /Applications/MAMP/bin/php5.3/bin/php
Resolved!
I uninstalled phpunit from pear and then reinstalled it again. I believe I was using the wrong/old/not enough sources before installing. Works like a charm!
So I'm trying to set up PEAR & PHPUnit. I was following http://www.newmediacampaigns.com/page/install-pear-phpunit-xdebug-on-macosx-snow-leopard but after I installed pear I had a different directory structure in /usr/local. Regardless, I was able run the phpunit install. But now I'm lost and asking for help before I make a bigger mess :)
pear config-show says:
PEAR directory php_dir /usr/local/share/pear
And my php.ini file (and confirmed in phpinfo() says:
include_path=".:/usr/local/share/pear"
So that's good, right? But now what? I get
Failed opening required 'PHPUnit/Framework.php' (include_path='.:/usr/local/share/pear')
If I try to include it in the php. And I have no idea where the binary might be to run it from the command line.
Inside /usr/local/share/pear/PHPUnit there are two directories "Extensions" and "Framework"
It sometimes happen that the install fails on PHPUnit specifically, but succeeds on the dependencies, so it only looks like the install was succesfull.
Try this when installing
pear install --force --alldeps phpunit/PHPUnit
The --force option will force the install of PHPUnit, even if all the dependencies can't be met. In my case there was a missing dependency for the dom PHP extension which blocked the installation even though the PHP_Invoker package could be used instead.
The --alldeps option makes sure that all of the dependencies got installed.
Check for a bin directory in the pear install, something along the lines of /usr/local/share/pear/bin/ - your install is different than mine..
You could also try searching for the binary -
find /usr/local/share/pear -name 'phpunit'
Does anybody know what I'm doing wrong?
I've installed phpunit, and everything is fine when I'm in the /opt/local/PEAR directory, so if I go to /opt/local/PEAR directory and run phpunit I get:
PHPUnit 3.5.11 by Sebastian Bergmann.
Usage: phpunit [switches] UnitTest [UnitTest.php]
phpunit [switches]
blablabla
but if I am on some other path I get:
Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/local/bin/phpunit on line 38
Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/lib/php') in /usr/local/bin/phpunit on line 38
I know that is something wrong with my PATH. How can I fix it?
Try adding /opt/local/PEAR to your php.ini file include_path.
//Before:
include_path='.:/usr/lib/php'
//After:
include_path='.:/usr/lib/php:/opt/local/PEAR'
You may also need to restart your web server afterwards for the changes to take effect.
And as RobertPitt comments, this can also be done at runtime without access to the php.ini file.
<?php
$path = '/opt/local/PEAR';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
?>
The PEAR channel (pear.phpunit.de) that is used to distribute PHPUnit needs to be registered with the local PEAR environment. Furthermore, component that PHPUnit depends upon are hosted on additional PEAR channels.
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:
pear install phpunit/PHPUnit
In Ubuntu, I used
pear config-set auto_discover 1
pear install pear.phpunit.de/PHP_CodeCoverage
For Ubuntu edit this php.ini for CLI:
/usr/local/lib/php.ini
add /usr/local/lib/php/ to your include line
include_path= "/opt/zend/library/:/var/www/library/:/usr/local/bin/pear/:/usr/local/lib/php/"
Took me a day to figure it out. Bingo.
If this does not work, try this, it will give you a hint where your PHP libs are located.
$ locate PHP_CodeCoverage
as far as I know PEAR installation method comes to his end, this is what's says about it on the github repository.
https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method