Setup include path for PEAR on Wamp

10,078

By adding those three lines to the ini, the last one will override everything. Only use this one

include_path = ".;C:\Program Files\wamp\bin\php\php5.3.8\pear"

Edit: adding @Gordon comment. We need to keep \pear. Because inner pear libraries are assuming that pear already in the include path.

http://pear.php.net/manual/en/installation.checking.php#installation.checking.cli.modifyingphpini

Share:
10,078
B Seven
Author by

B Seven

Status: Hood Rails on HTTP/2: Rails HTTP/2 Rack Gems: Rack Crud Rack Routing Capybara Jasmine

Updated on June 04, 2022

Comments

  • B Seven
    B Seven almost 2 years

    Installed PEAR and followed the directions on http://www.phpunit.de/manual/current/en/installation.html:

    pear config-set auto_discover 1
    pear install pear.phpunit.de/PHPUnit.
    

    Then, I created the test:

    <?php
    # error reporting
    ini_set('display_errors',1);
    error_reporting(E_ALL|E_STRICT);
    
    # include TestRunner
    require_once 'PHPUnit/TextUI/TestRunner.php';
    
    # our test class
    class ExampleTest extends PHPUnit_Framework_TestCase
    {
        public function testOne()
        {
            $this->assertTrue(FALSE);
        }
    }
    
    # run the test
    $suite = new PHPUnit_Framework_TestSuite('ExampleTest');
    PHPUnit_TextUI_TestRunner::run($suite);
    ?>
    

    I included the following in php.ini file and restarted Apache:

    include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8"
    include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8/pear"
    include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8/pear/PHPUnit"
    

    I get Warning: require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]: failed to open stream: No such file or directory in ...

    Why doesn't the include path work? Is it because there is a space in Program files?

    Working in Windows XP and WAMP.

    EDIT: I updated the path as suggested.

    The output of echo ini_get('include_path'); before require_once call is:

    .;C:\Program Files/wamp/bin/php/php5.3.8/pear
    

    Also, removing the require_once command throws Fatal error: Class 'PHPUnit_Framework_TestCase' not found in...