Installing PEAR and PHPUnit with xampp

后端 未结 8 1795
臣服心动
臣服心动 2020-12-12 18:27

I am trying to get PHPUnit up and running the following are the steps I am currently following:

### Install new PEAR Version needed for PHPUnit 3.X
### Downl         


        
相关标签:
8条回答
  • 2020-12-12 18:50

    this is a solution for a similar problem install propel orm in xampp. By default, pear tries install in c:\php\pear\data, and this folder don't exists, because pear is in c:\xampp\php\pear.

    Show pear configutarion:

    pear config-show
    ...
    pear config-get data_dir
    c:\php\pear\data
    

    Change the pear configuration to:

    pear config-set data_dir c:\xampp\php\pear\data
    

    i hope this is useful ;)

    0 讨论(0)
  • 2020-12-12 18:54

    This may help follow the below link: http://forum.kohanaframework.org/discussion/7346/installing-phpunit-on-windows-xampp/p1

    1. Open a command prompt and go to C:\xampp\php
    2. Type "pear update-channels" (updates channel definitions)
    3. Type "pear upgrade" (upgrades all existing packages and pear)
    4. Type "pear channel-discover components.ez.no" (this is needed for PHPUnit)
    5. Type "pear channel-discover pear.symfony-project.com" (also needed by PHPUnit)
    6. Type "pear channel-discover pear.phpunit.de" (This IS phpunit)
    7. Type "pear install --alldeps phpunit/PHPUnit" (installs PHPUnit and all dependencies)
    0 讨论(0)
  • 2020-12-12 18:54

    You might want to add

    • pear clear-cache to clear the REST/XML-RPC cache and
    • pear config-set preferred_state beta to set the preferred package state to beta

    This results in

    php go-pear.phar
    pear clear-cache 
    pear update-channels
    pear upgrade --alldeps -f 
    pear channel-discover pear.phpunit.de
    pear channel-discover pear.symfony-project.com
    pear channel-discover components.ez.no
    pear config-set preferred_state beta
    pear install --onlyreqdeps phpunit/PHPUnit
    
    0 讨论(0)
  • 2020-12-12 18:57

    If you are on Widows 8, make sure you opened a command window as administrator, otherwise dir creation will be silently rejected by the OS !

    0 讨论(0)
  • 2020-12-12 18:57

    I was able to get pear (and subsequently, phpunit) working by creating a symlink in C:\ that points to the xamp php installation directory. That makes everything that expects php to be in C:\php happy, while not breaking anything that expected php to be in xampp:

    In cmd.exe, I typed:

    C:\Windows>cd \
    C:\>junction php C:\path\to\xampp\php
    

    I updated my php.ini to use C:\php as the location for php. I then installed pear (as a local installation, not system). Once pear was installed, installing phpunit was simple:

    C:\>pear channel-discover components.ez.no
    C:\>pear channel-discover pear.phpunit.de
    C:\>pear channel-discover pear.symfony-project.com
    

    And then finally,

    C:\>pear install --alldeps phpunit/PHPUnit
    
    0 讨论(0)
  • 2020-12-12 18:59

    To install in D:\xampp\php, set the following directory paths using pear config-set command

    D:
    cd D:\xampp\php
    pear config-set doc_dir d:\xampp\php\pear\docs
    pear config-set cfg_dir d:\xampp\php\pear\cfg
    pear config-set data_dir d:\xampp\php\pear\data
    pear config-set cache_dir d:\xampp\php\pear\cache
    pear config-set download_dir d:\xampp\php\pear\download
    pear config-set temp_dir d:\xampp\php\pear\temp
    pear config-set test_dir d:\xampp\php\pear\tests
    pear config-set www_dir d:\xampp\php\pear\www
    
    0 讨论(0)
提交回复
热议问题