Include path problems installing PEAR/PHPUnit

11,589

The error message states that PHPUnit is located in this pear directory:

/usr/local/pear/share/pear/PHPUnit

This should transform into this path to be added to the include_path setting:

/usr/local/pear/share/pear

You currently defined /usr/local/bin/PEAR, which looks weird. Especially since the install directions state that it should be /usr/local/PEAR, but this depends on how PEAR was actually installed.

Share:
11,589
Farooq
Author by

Farooq

http://www.farooqyousuf.net http://www.fusionqa.net

Updated on June 27, 2022

Comments

  • Farooq
    Farooq almost 2 years

    I'm following this http://www.newmediacampaigns.com/page/install-pear-phpunit-xdebug-on-macosx-snow-leopard to install PEAR/PHPUnit. I'm having trouble with the include paths.

    Some background info:

    Farooqs-MacBook-Pro:bin fyousuf$ which php
    /usr/bin/php
    
    Farooqs-MacBook-Pro:bin fyousuf$ which pear
    /usr/local/bin/pear
    
    Farooqs-MacBook-Pro:bin fyousuf$ which phpunit
    /usr/local/bin/phpunit
    

    I think the part where I'm messing up is "Update PHP include path" in the link I posted above.

    This is what is in my php.ini file:

        ; UNIX: "/path1:/path2"
        ;include_path = ".:/php/includes"
        include_path = ”/usr/local/bin/PEAR:/php/includes”
        ;
        ; Windows: "\path1;\path2"
        ;include_path = ".;c:\php\includes"
        include_path = ”/usr/local/bin/PEAR:/php/includes”
        ;
        ; PHP's default setting for include_path is ".;/path/to/php/pear"
        ; http://php.net/include-path`
    

    When I try to run a Selenium test using phpunit I get this error:

       phpunit functions.php
    
       PHP Warning:  require_once(File/Iterator/Autoload.php): failed to open stream: No such            
       file or directory in /usr/local/pear/share/pear/PHPUnit/Autoload.php on line 64
       PHP Fatal error:  require_once(): Failed opening required 'File/Iterator/Autoload.php'         
       (include_path='”/usr/local/bin/PEAR:/php/includes”') in       
       /usr/local/pear/share/pear/PHPUnit/Autoload.php on line 64
    

    New Edits:

    I have PHPUnit installed:

    Farooqs-MacBook-Pro:echo360-5.0 fyousuf$ sudo pear install phpunit/PHPUnit phpunit/PHPUnit is already installed and is the same as the released version 3.7.27 install failed

    But when I type phpunit in terminal I get the same error as before:

    PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /usr/local/pear/share/pear/PHPUnit/Autoload.php on line 64 PHP Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:/usr/local/PEAR:/php/includes') in /usr/local/pear/share/pear/PHPUnit/Autoload.php on line 64

  • Farooq
    Farooq over 10 years
    I have PHPUnit installed:
  • Farooq
    Farooq over 10 years
    Sorry, I hit enter by mistake :) Thanks for the answer, it helped to fix the problem.
  • Farooq
    Farooq over 10 years
    Originally I had this in my include_path in /etc/php.ini: include_path = ".:/usr/local/PEAR:/php/includes" But I had to change it to this to fix the problem: include_path = ".:/usr/local/PEAR:/usr/local/pear/share/pear:/php/includes"
  • Sven
    Sven over 10 years
    You should always try and keep the include path as short as possible. Have you made sure the path /usr/local/PEAR exists on your system? If not, remove that part - it isn't useful. It will only cost performance when including files.