5

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

1
  • For those Googlers who land here because they need to know the path to Pear's PHP files: The best approach is to simply execute (on the command line): pear config-get php_dir Commented Nov 19, 2014 at 21:19

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I have PHPUnit installed:
Sorry, I hit enter by mistake :) Thanks for the answer, it helped to fix the problem.
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"
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.