Installing phpunit via Ansible - php

I'm attempting to install phpunit via ansible with a view to running it on a vagrant vm, however I keep receiving an error in the build process:
Channel "pear.phpunit.de" is not initialized, use "pear channel-discover pear.phpunit.de" to initializeor pear config-set auto_discover 1
unknown channel "pear.phpunit.de" in "pear.phpunit.de/PHPUnit"
invalid package name/package file "pear.phpunit.de/PHPUnit"
install failed
The ansbile config looks something like:
- name: Install phpunit
command: pear channel-discover pear.phpunit.de
command: pear channel-discover pear.symfony-project.com
command: pear channel-discover components.ez.no
command: pear channel-discover pear.symfony.com
command: pear update-channels
command: pear upgrade-all
command: pear install pear.symfony.com/Yaml
command: pear install --alldeps pear.phpunit.de/PHPUnit
command: pear install --force --alldeps pear.phpunit.de/PHPUnit
Has anyone managed to successfully get phpunit to install via ansible?

Since the pear installer for PHPUnit is no longer supported. If you want to install PHPUnit with ansible you could do:
get_url: url=https://phar.phpunit.de/phpunit.phar dest=/usr/local/bin/phpunit mode=555

The playlist snippet you pasted is incorrect–it will only run the first command because you can't specify multiple commands in a single task. Try this list of tasks, instead:
- command: pear channel-discover pear.phpunit.de
- command: pear channel-discover pear.symfony-project.com
- command: pear channel-discover components.ez.no
- command: pear channel-discover pear.symfony.com
- command: pear update-channels
- command: pear upgrade-all
- command: pear install pear.symfony.com/Yaml
- command: pear install --alldeps pear.phpunit.de/PHPUnit
- command: pear install --force --alldeps pear.phpunit.de/PHPUnit
You don't need to specify a - name for every task, but you do have to use the hyphen before each command to signal to Ansible that this is a new task.

More infor about no longer supported PEAR installation method:
https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method
Russell's method works fine.

Related

Install SSH Module Pear

How to install module crypt_random_string, Crypt_Hash, and Crypt_Base with php pear?
I tried to use pear list-all but there's no module from that module.
And I tried using the following commands
pear install phpseclib/crypt_random_string
pear install phpseclib/Crypt_Hash
pear install phpseclib/Crypt_Base
but it's giving me the following error install failed.
Did you follow:
pear channel-discover phpseclib.sourceforge.net
pear remote-list -c phpseclib
pear install phpseclib/Crypt_Random
pear install phpseclib/Crypt_Hash
pear install phpseclib/Crypt_Base
Also provide us pear version, OS

PHP Copy Paste Detector on Ubuntu machine

I want to install PHP Copy Paste Detector on Ubuntu machine, for this I used that command:-
sudo pear config-set auto_discover 1
that is run scussfully, but when I try that command:-
sudo pear install pear.phpunit.de/phpcpd
this is showing error message
error is :-
No releases available for package "pear.phpunit.de/phpcpd"
install failed
I tried many command for this like:-
pear config-set auto_discover 1
pear install --force --alldeps pear.phpqatools.org/phpqatools
sudo pear channel-discover pear.phpunit.de
pear clear-cache etc. but one help full for me.
Sebastian Bergmann, author of phpunit, switched off phpunit's pear channel some time ago rendering your efforts useless.
You now need to use either the .phar or install phpcpd via composer instead - details are here at https://github.com/sebastianbergmann/phpcpd

trouble installing pear on Mac 10.9 with MAMP installed

Ok, I'm using a MacBook and have MAMP PRO installed for PHP environment.
I'm trying to use Pear to install PHPUnit, but can't get it working. PHPUnit tells me pear: command not found
I came across a tutorial that suggests using sudo php install-pear-nozlib.phar to install pear, but when I run it, I get the following:
[PEAR] Archive_Tar - already installed: 1.3.7
[PEAR] Console_Getopt - already installed: 1.3.0
[PEAR] Structures_Graph- already installed: 1.0.4
[PEAR] XML_Util - already installed: 1.2.1
[PEAR] PEAR - already installed: 1.9.4
Wrote PEAR system config file at: /Applications/MAMP/bin/php/php5.4.10/conf/pear.conf
You may want to add: /Applications/MAMP/bin/php/php5.4.10/lib/php to your php.ini include_path
okay, so it thinks Pear is already installed, but I can't seem to reference it to do anything without the command not found error. I'm thinking that there's some sort of conflict as it's already installed as part of MAMP, but that the MAMP version isn't being referenced through the command line?
I know very little about terminal commands. Is my thinking even on the right track?
The answer is in the error message:
You may want to add: /Applications/MAMP/bin/php/php5.4.10/lib/php
to your php.ini include_path
There is the MAMP install of PHP & the systemwide PHP. You need to use the MAMP specific install of PHP. Try this command.
sudo /Applications/MAMP/bin/php/php5.4.10/lib/php install-pear-nozlib.phar
Also, here are my notes on installing phpunit under Mac OS X 10.6.8. Should work for Mac OS X 10.9. Mind you this is for a system install of phpunit and not MAMP specific.
First get curl to get the go-pear.phar:
http://pear.php.net/go-pear.phar > go-pear.phar
At this point you might need to edit your .bash_profile and add /usr/local/pear/bin to $PATH.
Now run go-pear.phar:
sudo php -q go-pear.phar
Set the pear channels:
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover pear.symfony.com
Might need to explicitly indicate with pear you need when running the commands so this can work as well:
sudo /usr/local/pear/bin/pear channel-discover pear.phpunit.de
sudo /usr/local/pear/bin/pear channel-discover components.ez.no
sudo /usr/local/pear/bin/pear channel-discover pear.symfony-project.com
sudo /usr/local/pear/bin/pear channel-discover pear.symfony.com
Now install phpunit:
sudo pear install --alldeps phpunit/PHPUnit
Now edit php.ini:
sudo nano /etc/php.ini
Find the includes path entry:
;include_path = ".:/php/includes/"
Uncomment—if it is commented—and change it to include the pear path:
include_path = ".:/usr/local/pear/share/pear:/php/includes/"

propel-gen: command not found (phing)

I've installed the Propel ORM in my Zend Framework project with the following commands:
pear channel-discover pear.phing.info
pear install phing/phing
pear install Log
But always when I try to run propel-gen I get the following error:
propel-gen: command not found
I've already looked at this post on stackoverflow and tried the following:
When I check $ pear list I get the following:
When I run the following command:
pear config-get bin_dir
I get this: /Applications/MAMP/bin/php/php5.4.4/bin
I've checked my .bash_profile:
PATH=/Applications/MAMP/bin/php/php5.4.4/bin:/Applications/MAMP/Library/bin:$PATH
export PATH
I assume that this is correct?
I forgot to install propel but when I want to load the command
propel-gen om
I get the following erros:
(build.properties and schema.xml are in the same directory)
You have actually installed phing and not propel. To install propel issue the following commands:
pear channel-discover pear.propelorm.org
pear install -a propel/propel_generator
pear install -a propel/propel_runtime
Further note that you have to pass the -a option to pear list to see packages from all channels:
pear list -a
Cannot see where you have done this
pear channel-discover pear.propelorm.org
pear install -a propel/propel_generator
pear install -a propel/propel_runtime
Assume you have ?

How can I get a phpunit.bat after install phpunit via PEAR?

I need a phpunit.bat to configure my NetBeans IDE.
I'm using wamp, and I just install phpunit via pear using these instructions:
Before start using PEAR, Update by downloading last go-pear from http://pear.php.net/go-pear.phar and save it into: C:\wamp\bin\php\php5.3.3\PEAR
Then:
cd C:\wamp\bin\php\php5.3.0>
php -d phar.require_hash=0 PEAR/go-pear.phar
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install phpunit/PHPUnit
After do that I can't find any phpunit.bat or phpunit.php
How can I get a phpunit.bat (or any CLI) after install phpunit via PEAR?
Type:
pear config-show
look for the PEAR executables directory
Your phpunit.bat will be there.
If it isn't:
pear install --alldeps --force phpunit/phpunit
and look again.

Categories